Archive::Peek::Libarchive - Peek into archives without extracting them (using libarchive)
use Archive::Peek::Libarchive; my $peek = Archive::Peek::Libarchive->new( filename => 'archive.tgz' ); my @files = $peek->files(); my $contents = $peek->file('README.txt') $peek->iterate( sub { my ( $filename, $contents ) = @_; ... } );
This module lets you peek into archives without extracting them. This is a wrapper to the libarchive C library (http://code.google.com/p/libarchive/), which you must have installed (libarchive-dev package for Debian/Ubuntu). It supports many different archive formats and compression algorithms and is fast.
The constructor takes the filename of the archive to peek into:
my $peek = Archive::Peek::Libarchive->new( filename => 'archive.tgz' );
Returns the files in the archive:
my @files = $peek->files();
Returns the contents of a file in the archive:
my $contents = $peek->file('README.txt')
Iterate over all the files in the archive:
$peek->iterate( sub { my ( $filename, $contents ) = @_; ... } );
Contains the name of the archive file to use.
Leon Brocard <acme@astray.com>
Copyright (C) 2011, Leon Brocard.
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
To install Archive::Peek::Libarchive, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Archive::Peek::Libarchive
CPAN shell
perl -MCPAN -e shell install Archive::Peek::Libarchive
For more information on module installation, please visit the detailed CPAN module installation guide.