Question

I wish to use Perl module IO::Uncompress::AnyUncompress, which is documented here : http://perldoc.perl.org/IO/Uncompress/AnyUncompress.html.

However, this documentation seems to elude the fact that a compressed archive (.zip, .7z) contains a tree of compressed files. I would like to extract only a single file from the archive and not the full archive, for example :

my $archivename = 'archive.7z';
my $filetoextract = './bin/file.lib';

my $archive = new IO::Uncompress::AnyUncompress($archivename);
my $filecontent = $archive->extract($filetoextract);

However, the API does not seem to have such an extract() fonction, neither a function that would return the list of files contained in the archive.

Have I missed something ?

Was it helpful?

Solution

IO::Uncompress::AnyUncompress only deals with a single compressed byte stream. You'll need a module like Archive::Any, Archive::Any::Lite, or Archive::Libarchive::XS.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top