| Tar documentation | view source | Contained in the Tar distribution. |
Tar - module for manipulation of tar archives.
use Tar;
$tar = Tar->new();
$tar->add_files("file/foo.c", "file/bar.c");
$tar->add_data("file/bar.c","This is the file contents");
$tar->write("files.tar");
This module is definitely tentative, and several things will be changed rather shortly. The exported routines will not be exported [done], all the calls to croak() should be replaced with returning undef() and putting error messages in a package global [done].
At the moment these methods are implemented:
new()Returns a new Tar object. If given a filename as an argument, it will try to load that as a tar file.
add_files(@filenamelist)Takes a list of filenames and adds them to the in-memory archive.
add_data($filename,$data,$opthashref)Takes a filename, a scalar full of data and optionally a reference to
a hash with specific options. Will add a file to the in-memory
archive, with name $filename and content $data. Specific options
can be set using $opthashref, which will be documented later.
remove(@filenamelist)Removes any entries with names matching any of the given filenames
from the in-memory archive. String comparisons are done with eq.
read('file.tar')Try to read the given tarfile into memory. Will replace any previous
content in $tar!
write('file.tar')Will write the in-memory archive to disk.
data()Returns the in-memory archive. This is a list of references to hashes, the internals of which is not currently documented.
extract(@filenames)Write files whose names are equivalent to any of the names in
@filenames to disk, creating subdirectories as neccesary. This
might not work too well under VMS and MacOS.
| Tar documentation | view source | Contained in the Tar distribution. |