.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Archive::Cpio 3pm" .TH Archive::Cpio 3pm "2020-12-25" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Archive::Cpio \- module for manipulations of cpio archives .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Archive::Cpio; \& \& # simple example removing entry "foo" \& \& my $cpio = Archive::Cpio\->new; \& $cpio\->read($file); \& $cpio\->remove(\*(Aqfoo\*(Aq); \& $cio\->write($file); \& \& # more complex example, filtering on the fly \& \& my $cpio = Archive::Cpio\->new; \& $cpio\->read_with_handler(\e*STDIN, \& sub { \& my ($e) = @_; \& if ($e\->name ne \*(Aqfoo\*(Aq) { \& $cpio\->write_one(\e*STDOUT, $e); \& } \& }); \& $cpio\->write_trailer(\e*STDOUT); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Archive::Cpio provides a few functions to read and write cpio files. .SS "Archive::Cpio\->\fBnew()\fP" .IX Subsection "Archive::Cpio->new()" Create an object .ie n .SS "$cpio\->read($filename)" .el .SS "\f(CW$cpio\fP\->read($filename)" .IX Subsection "$cpio->read($filename)" .ie n .SS "$cpio\->read($filehandle)" .el .SS "\f(CW$cpio\fP\->read($filehandle)" .IX Subsection "$cpio->read($filehandle)" Reads the cpio file .ie n .SS "$cpio\->write($filename)" .el .SS "\f(CW$cpio\fP\->write($filename)" .IX Subsection "$cpio->write($filename)" .ie n .SS "$cpio\->write($filehandle)" .el .SS "\f(CW$cpio\fP\->write($filehandle)" .IX Subsection "$cpio->write($filehandle)" Writes the entries and the trailer .ie n .SS "$cpio\->remove(@filenames)" .el .SS "\f(CW$cpio\fP\->remove(@filenames)" .IX Subsection "$cpio->remove(@filenames)" Removes any entries with names matching any of the given filenames from the in-memory archive .ie n .SS "$cpio\->get_files([ @filenames ])" .el .SS "\f(CW$cpio\fP\->get_files([ \f(CW@filenames\fP ])" .IX Subsection "$cpio->get_files([ @filenames ])" Returns a list of \f(CW\*(C`Archive::Cpio::File\*(C'\fR (after a \f(CW\*(C`$cpio\-\*(C'\fRread>) .ie n .SS "$cpio\->get_file($filename)" .el .SS "\f(CW$cpio\fP\->get_file($filename)" .IX Subsection "$cpio->get_file($filename)" Returns the \f(CW\*(C`Archive::Cpio::File\*(C'\fR matching \f(CW\*(C`$filename< (after a \f(CW\*(C`$cpio\-\*(C'\f(CWread\*(C'\fR) .ie n .SS "$cpio\->add_data($filename, $data, $opthashref)" .el .SS "\f(CW$cpio\fP\->add_data($filename, \f(CW$data\fP, \f(CW$opthashref\fP)" .IX Subsection "$cpio->add_data($filename, $data, $opthashref)" Takes a filename, a scalar full of data and optionally a reference to a hash with specific options. .PP Will add a file to the in-memory archive, with name \f(CW$filename\fR and content \f(CW$data\fR. Specific properties can be set using \f(CW$opthashref\fR. .ie n .SS "$cpio\->read_with_handler($filehandle, $coderef)" .el .SS "\f(CW$cpio\fP\->read_with_handler($filehandle, \f(CW$coderef\fP)" .IX Subsection "$cpio->read_with_handler($filehandle, $coderef)" Calls the handler function on each header. An \f(CW\*(C`Archive::Cpio::File\*(C'\fR is passed as a parameter .ie n .SS "$cpio\->write_one($filehandle, $entry)" .el .SS "\f(CW$cpio\fP\->write_one($filehandle, \f(CW$entry\fP)" .IX Subsection "$cpio->write_one($filehandle, $entry)" Writes a \f(CW\*(C`Archive::Cpio::File\*(C'\fR (beware, a valid cpio needs a trailer using \f(CW\*(C`write_trailer\*(C'\fR) .ie n .SS "$cpio\->write_trailer($filehandle)" .el .SS "\f(CW$cpio\fP\->write_trailer($filehandle)" .IX Subsection "$cpio->write_trailer($filehandle)" Writes the trailer to finish the cpio file .SH "AUTHOR" .IX Header "AUTHOR" Pascal Rigaux