Archive::Cpio(3)
π NAME π
okay so bestie, welcome to the Archive::Cpio(3) page. The whole name-and-purpose situation is: Archive::Cpio - module for manipulations of cpio archives. Thatβs the vibe, thatβs the assignment, periodt. π
β¨ SYNOPSIS β¨
First up, the simple example removing entry "foo" β yes, keep the quotes, theyβre in the code:
use Archive::Cpio;
# simple example removing entry "foo"
my $cpio = Archive::Cpio->new;
$cpio->read($file);
$cpio->remove('foo');
$cio->write($file);
Then the more complex example, filtering on the fly:
# 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);
π DESCRIPTION π
Archive::Cpio provides a few functions to read and write cpio files. Lowkey a little toolkit, highkey useful. π¦
π Archive::Cpio->new()
Create an object. Thatβs it β constructor slay. β¨
π $cpio->read($filename) / $cpio->read($filehandle)
Reads the cpio file. Filename or filehandle, your call, bestie. π
π $cpio->write($filename) / $cpio->write($filehandle)
Writes the entries and the trailer. Entries plus trailer, no skipping the trailer. π
π§ $cpio->remove(@filenames)
Removes any entries with names matching any of the given filenames from the in-memory archive. Itβs giving cleanup era. π
π $cpio->get_files([ @filenames ])
Returns a list of Archive::Cpio::File (after a "$cpio-"read>). Thatβs the exact slightly chaotic reference from the page β weβre preserving it, no cap. π
π¦ $cpio->get_file($filename)
Returns the Archive::Cpio::File matching "$filename< (after a "$cpio-"read"). Exact page energy again. π«Ά
π₯ $cpio->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 properties can be set using $opthashref. Add-data main character energy. π
πΈ $cpio->read_with_handler($filehandle, $coderef)
Calls the handler function on each header. An Archive::Cpio::File is passed as a parameter. Handler-on-each-header realness. β¨
β $cpio->write_one($filehandle, $entry)
Writes a Archive::Cpio::File (beware, a valid cpio needs a trailer using write_trailer). Important caveat, bestie: a valid cpio needs that trailer, so donβt forget it. π
π $cpio->write_trailer($filehandle)
Writes the trailer to finish the cpio file. The finishing bow on the whole archive. π
πΈ AUTHOR πΈ
Pascal Rigaux <pixel@mandriva.com>. Author icon, shoutout. π
Thatβs the whole page, bestie! This footer vibe is perl v5.42.2, dated 2026-02-15, signing off. Byeeee π
π¦ where this page comes from
- alpine 3.24: perl-archive-cpio-doc 0.10-r4 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms