---
name: "Arch::Tarball"
section: "3pm"
platform: "linux"
package: "libarch-perl"
version: "0.5.2-2"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/Arch::Tarball"
---

# Arch::Tarball(3pm)

an interface to create and work with tarballs

## 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**.

- **new** *%opts*

  Creates a new Arch::Tarball object.

  The following parameters can be set via *%opts*:

  - **tar**

    The name of the *tar* executable. Defaults to `"tar"`.

  - **file**

    The filename of the Tarball.

- **create** *%opts*

  Creates a new tarball (tar.gz) from a given directory structure.

  **create** understands the following options:

  - **dir** (mandatory)

    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.

  - **base\_name**

    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**.

  - **pipe**

    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.

- **extract** *%opts*

  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.

- **list** *%opts* (not implemented yet)

  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).
