The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Filesys::POSIX::Userland::Tar - Generate ustar archives from Filesys::POSIX

SYNOPSIS

    use Filesys::POSIX;
    use Filesys::POSIX::Mem;
    use Filesys::POSIX::IO::Handle;
    use Filesys::POSIX::Userland::Tar;

    my $fs = Filesys::POSIX->new(Filesys::POSIX::Mem->new,
        'noatime' => 1
    );

    $fs->mkdir('foo');
    $fs->touch('foo/bar');

    $fs->tar(Filesys::POSIX::IO::Handle->new(\*STDOUT), '.');

DESCRIPTION

This module provides an implementation of the ustar standard on top of the virtual filesystem layer, a mechanism intended to take advantage of the many possible mapping and manipulation capabilities inherent in this mechanism. Internally, it uses the Filesys::POSIX::Userland::Find module to perform depth- last recursion to locate inodes for packaging.

As mentioned, archives are written in the ustar format, with pathnames of the extended maximum length of 256 characters, supporting file sizes up to 4GB. Currently, only user and group IDs are stored; names are not resolved and stored as of the time of this writing. All inode types are supported for archival.

USAGE

$fs->tar($handle, @items)
$fs->tar($handle, $opts, @items)

Locate files and directories in each path specified in the @items array, writing results to the I/O handle wrapper specified by $handle, an instance of Filesys::POSIX::IO::Handle. When an anonymous HASH argument, $opts, is specified, the data is passed unmodified to Filesys::POSIX::Userland::Find. In this way, for instance, the behavior of following symlinks can be specified.

In addition to options supported by Filesys::POSIX::Userland::Find, the following options are recognized uniquely by $fs->tar():

gnu_extensions

When set, certain GNU extensions to the tar output format are enabled, namely support for arbitrarily long filenames.

ignore_missing

When set, ignore if a file is missing when writing it to the tarball. This can happen if a file is removed between the time the find functionality finds it and the time it is actually written to the output. If the value is a coderef, calls that function with the name of the missing file.

ignore_inaccessible

When set, ignore if a file is unreadable when writing it to the tarball. This can happen if a file permissions do not allow the current UID and GID to read the file. If the value is a coderef, calls that function with the name of the inaccessible file.

AUTHOR

Written by Xan Tronix <xan@cpan.org>

CONTRIBUTORS

Rikus Goodell <rikus.goodell@cpanel.net>
Brian Carlson <brian.carlson@cpanel.net>
John Lightsey <jd@cpanel.net>

COPYRIGHT

Copyright (c) 2014, cPanel, Inc. Distributed under the terms of the Perl Artistic license.