Archive::Ar

Archive::Ar is a Perl interface for manipulating ar archives.
Download

Archive::Ar Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Jay Bonci
  • Publisher web site:
  • http://search.cpan.org/~jaybonci/

Archive::Ar Tags


Archive::Ar Description

Archive::Ar is a Perl interface for manipulating ar archives. Archive::Ar is a Perl interface for manipulating ar archives.SYNOPSIS use Archive::Ar; my $ar = new Archive::Ar("./foo.ar"); $ar->add_data("newfile.txt","Some contents", $properties); $ar->add_files("./bar.tar.gz", "bat.pl") $ar->add_files(); $ar->remove("file1", "file2"); $ar->remove() Takes an array or an arrayref of filenames to add to the ar archive, in order. The filenames can be paths to files, in which case the path information is stripped off. Filenames longer than 16 characters are truncated when written to disk in the format, so keep that in mind when adding files.Due to the nature of the ar archive format, add_files() will store the uid, gid, mode, size, and creation date of the file as returned by stat();add_files() returns the number of files successfully added, or undef on failure.add_data("filename", $filedata) Takes an filename and a set of data to represent it. Unlike add_files, add_data is a virtual add, and does not require data on disk to be present. The data is a hash that looks like: $filedata = { "data" => $data, "uid" => $uid, #defaults to zero "gid" => $gid, #defaults to zero "date" => $date, #date in epoch seconds. Defaults to now. "mode" => $mode, #defaults to "100644"; }You cannot add_data over another file however. This returns the file length in bytes if it is successful, undef otherwise.write()write("filename.ar") This method will return the data as an .ar archive, or will write to the filename present if specified. If given a filename, write() will return the length of the file written, in bytes, or undef on failure. If the filename already exists, it will overwrite that file.get_content("filename") This returns a hash with the file content in it, including the data that the file would naturally contain. If the file does not exist or no filename is given, this returns undef. On success, a hash is returned with the following keys: name - The file name date - The file date (in epoch seconds) uid - The uid of the file gid - The gid of the file mode - The mode permissions size - The size (in bytes) of the file data - The contained dataremove("filename1", "filename2")remove() The remove method takes a filenames as a list or as an arrayref, and removes them, one at a time, from the Archive::Ar object. This returns the number of files successfully removed from the archive.DEBUG() This method turns on debugging. Optionally this can be done by passing in a value as the second parameter to new. While verbosity is enabled, Archive::Ar will toss a warn() if there is a suspicious condition or other problem while proceeding. This should help iron out any problems you have while using the module.Requirements:· PerlWhat's New in This Release:· Fixes to the Makefile.PL file. Ar.pm wasn't being put into /blib Style fix to a line with non-standard unless parenthesis


Archive::Ar Related Software