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.
$filename
$data
$opthashref
remove(@filenamelist)
Removes any entries with names matching any of the given filenames from the in-memory archive. String comparisons are done with eq.
eq
read('file.tar')
Try to read the given tarfile into memory. Will replace any previous content in $tar!
$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.
@filenames
1 POD Error
The following errors were encountered while parsing the POD:
=over without closing =back
To install Tar, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tar
CPAN shell
perl -MCPAN -e shell install Tar
For more information on module installation, please visit the detailed CPAN module installation guide.