Filesys::POSIX::Userland::Tar - Generate ustar archives from Filesys::POSIX
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), '.');
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.
$fs->tar($handle, $opts, @items)
Locate files and directories in each path specified in the
@itemsarray, 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
When set, certain GNU extensions to the tar output format are enabled, namely support for arbitrarily long filenames.
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.
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.
Written by Xan Tronix <firstname.lastname@example.org>
- Rikus Goodell <email@example.com>
- Brian Carlson <firstname.lastname@example.org>
- John Lightsey <email@example.com>
Copyright (c) 2014, cPanel, Inc. Distributed under the terms of the Perl Artistic license.