man-pages/man3/Archive::Cpio.3pm.html
2021-03-31 01:06:50 +01:00

189 lines
4.3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of Archive::Cpio</TITLE>
</HEAD><BODY>
<H1>Archive::Cpio</H1>
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2017-05-06<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
Archive::Cpio - module for manipulations of cpio archives
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
use Archive::Cpio;
# simple example removing entry &quot;foo&quot;
my $cpio = Archive::Cpio-&gt;new;
$cpio-&gt;read($file);
$cpio-&gt;remove('foo');
$cio-&gt;write($file);
# more complex example, filtering on the fly
my $cpio = Archive::Cpio-&gt;new;
$cpio-&gt;read_with_handler(\*STDIN,
sub {
my ($e) = @_;
if ($e-&gt;name ne 'foo') {
$cpio-&gt;write_one(\*STDOUT, $e);
}
});
$cpio-&gt;write_trailer(\*STDOUT);
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
Archive::Cpio provides a few functions to read and write cpio files.
<A NAME="lbAE">&nbsp;</A>
<H3>Archive::Cpio-&gt;<I>new()</I></H3>
Create an object
<A NAME="lbAF">&nbsp;</A>
<H3>$cpio-&gt;read($filename)</H3>
<A NAME="lbAG">&nbsp;</A>
<H3>$cpio-&gt;read($filehandle)</H3>
Reads the cpio file
<A NAME="lbAH">&nbsp;</A>
<H3>$cpio-&gt;write($filename)</H3>
<A NAME="lbAI">&nbsp;</A>
<H3>$cpio-&gt;write($filehandle)</H3>
Writes the entries and the trailer
<A NAME="lbAJ">&nbsp;</A>
<H3>$cpio-&gt;remove(@filenames)</H3>
Removes any entries with names matching any of the given filenames from the in-memory archive
<A NAME="lbAK">&nbsp;</A>
<H3>$cpio-&gt;get_files([ @filenames ])</H3>
Returns a list of <TT>&quot;Archive::Cpio::File&quot;</TT> (after a <TT>&quot;$cpio-&quot;</TT>read&gt;)
<A NAME="lbAL">&nbsp;</A>
<H3>$cpio-&gt;get_file($filename)</H3>
Returns the <TT>&quot;Archive::Cpio::File&quot;</TT> matching <TT>&quot;$filename&lt; (after a &quot;$cpio-&quot;read&quot;</TT>)
<A NAME="lbAM">&nbsp;</A>
<H3>$cpio-&gt;add_data($filename, $data, $opthashref)</H3>
Takes a filename, a scalar full of data and optionally a reference to a hash with specific options.
<P>
Will add a file to the in-memory archive, with name <TT>$filename</TT> and content <TT>$data</TT>.
Specific properties can be set using <TT>$opthashref</TT>.
<A NAME="lbAN">&nbsp;</A>
<H3>$cpio-&gt;read_with_handler($filehandle, $coderef)</H3>
Calls the handler function on each header. An <TT>&quot;Archive::Cpio::File&quot;</TT> is passed as a parameter
<A NAME="lbAO">&nbsp;</A>
<H3>$cpio-&gt;write_one($filehandle, $entry)</H3>
Writes a <TT>&quot;Archive::Cpio::File&quot;</TT> (beware, a valid cpio needs a trailer using <TT>&quot;write_trailer&quot;</TT>)
<A NAME="lbAP">&nbsp;</A>
<H3>$cpio-&gt;write_trailer($filehandle)</H3>
Writes the trailer to finish the cpio file
<A NAME="lbAQ">&nbsp;</A>
<H2>AUTHOR</H2>
Pascal Rigaux &lt;<A HREF="mailto:pixel@mandriva.com">pixel@mandriva.com</A>&gt;
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DL>
<DT id="4"><A HREF="#lbAE">Archive::Cpio-&gt;<I>new()</I></A><DD>
<DT id="5"><A HREF="#lbAF">$cpio-&gt;read($filename)</A><DD>
<DT id="6"><A HREF="#lbAG">$cpio-&gt;read($filehandle)</A><DD>
<DT id="7"><A HREF="#lbAH">$cpio-&gt;write($filename)</A><DD>
<DT id="8"><A HREF="#lbAI">$cpio-&gt;write($filehandle)</A><DD>
<DT id="9"><A HREF="#lbAJ">$cpio-&gt;remove(@filenames)</A><DD>
<DT id="10"><A HREF="#lbAK">$cpio-&gt;get_files([ @filenames ])</A><DD>
<DT id="11"><A HREF="#lbAL">$cpio-&gt;get_file($filename)</A><DD>
<DT id="12"><A HREF="#lbAM">$cpio-&gt;add_data($filename, $data, $opthashref)</A><DD>
<DT id="13"><A HREF="#lbAN">$cpio-&gt;read_with_handler($filehandle, $coderef)</A><DD>
<DT id="14"><A HREF="#lbAO">$cpio-&gt;write_one($filehandle, $entry)</A><DD>
<DT id="15"><A HREF="#lbAP">$cpio-&gt;write_trailer($filehandle)</A><DD>
</DL>
<DT id="16"><A HREF="#lbAQ">AUTHOR</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:35 GMT, March 31, 2021
</BODY>
</HTML>