Scroll to navigation

Arch::Tarball(3pm) User Contributed Perl Documentation Arch::Tarball(3pm)

NAME

Arch::Tarball - an interface to create and work with tarballs

SYNOPSIS

    use Arch::Tarball
    my $tarball = Arch::Tarball->new;
    my $pipe = $tarball->create(
        dir => '/path/to/subdir-to-pack',
        base_name => 'new-subdir-to-pack',
        pipe => 1,
    );

DESCRIPTION

Arch::Tarball provides an object oriented interface to work with (create, examine or extract) standard gzipped tarballs.

Note: As functionality is added only when needed, a lot of features are currently not implemented.

METHODS

The following functions are available:

new, create, extract, list.

Creates a new Arch::Tarball object.

The following parameters can be set via %opts:

The name of the tar executable. Defaults to "tar".
The filename of the Tarball.
Creates a new tarball (tar.gz) from a given directory structure.

create understands the following options:

Specifies the base directory for the tarball. The given directory and recursively its content will be added to the tarball. The directory's basename will be used as the first and the only subdirectory in the tarball.
Allow the programmer to specify a different base directory name for the tarball content than the basename of dir. In this case, 'cp' process is launched to temporarily rename the last element of dir.
When set, create does not create a physical tarball but writes the tarballs content to a newly created pipe. The pipe is returned by the create method.

Note: Currently the pipe option is mandatory.

Extracts the tarball to a given target directory, specified by dir option. If dir option is not given, a temporary directory is created that will hold the extracted dirs/files. This directory is returned.

The file option specifies the tarball file name. It may be given in the constructor instead.

Returns a list of files and directories in the tarball.

BUGS

Most functionality is currently not implemented. If you need part of the missing functionality, please contact the authors.

Patches are greatly appreciated.

AUTHORS

Mikhael Goikhman (migo@homemail.com--Perl-GPL/arch-perl--devel).

Enno Cramer (uebergeek@web.de--2003/arch-perl--devel).

2022-06-08 perl v5.34.0