Archive::Cpio - module for manipulations of cpio archives
use Archive::Cpio; # simple example removing entry "foo" my $cpio = Archive::Cpio->new; $cpio->read($file); $cpio->remove('foo'); $cio->write($file); # more complex example, filtering on the fly my $cpio = Archive::Cpio->new; $cpio->read_with_handler(\*STDIN, sub { my ($e) = @_; if ($e->name ne 'foo') { $cpio->write_one(\*STDOUT, $e); } }); $cpio->write_trailer(\*STDOUT);
Archive::Cpio provides a few functions to read and write cpio files.
Create an object
Reads the cpio file
Writes the entries and the trailer
Removes any entries with names matching any of the given filenames from the in-memory archive
Returns a list of Archive::Cpio::File (after a $cpio-read>)
Archive::Cpio::File
$cpio-
Returns the Archive::Cpio::File matching $filename< (after a $cpio-read)
$filename< (after a $cpio-read
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 properties can be set using $opthashref.
$filename
$data
$opthashref
Calls the handler function on each header. An Archive::Cpio::File is passed as a parameter
Writes a Archive::Cpio::File (beware, a valid cpio needs a trailer using write_trailer)
write_trailer
Writes the trailer to finish the cpio file
Pascal Rigaux <pixel@mandriva.com>
To install Archive::Cpio, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Archive::Cpio
CPAN shell
perl -MCPAN -e shell install Archive::Cpio
For more information on module installation, please visit the detailed CPAN module installation guide.