/usr/share/doc/perl-Archive-Zip/examples
NameSizeModeActions
calcSizes.pl9480644editdlrm
copy.pl4520644editdlrm
extract.pl8960644editdlrm
mailZip.pl16130644editdlrm
mfh.pl6400644editdlrm
readScalar.pl7500644editdlrm
selfex.pl15690644editdlrm
unzipAll.pl5610644editdlrm
updateTree.pl8220644editdlrm
updateZip.pl8920644editdlrm
writeScalar.pl6140644editdlrm
writeScalar2.pl6130644editdlrm
zip.pl6660644editdlrm
zipcheck.pl10100644editdlrm
zipGrep.pl14510644editdlrm
zipinfo.pl44660644editdlrm
ziprecent.pl77060644editdlrm
ziptest.pl18010644editdlrm
Edit: /usr/share/doc/perl-Archive-Zip/examples/zipGrep.pl (1451B)
#!/usr/bin/perl -w # This program searches for the given Perl regular expression in a Zip archive. # Archive is assumed to contain text files. # By Ned Konz, perl@bike-nomad.com # Usage: # perl zipGrep.pl 'pattern' myZip.zip # use strict; use Archive::Zip qw(:CONSTANTS :ERROR_CODES); if (@ARGV != 2) { print <new(); if ($zip->read($zipName) != AZ_OK) { die "Read error reading $zipName\n"; } foreach my $member ($zip->members()) { my ($bufferRef, $status, $lastChunk); my $memberName = $member->fileName(); my $lineNumber = 1; $lastChunk = ''; $member->desiredCompressionMethod(COMPRESSION_STORED); $status = $member->rewindData(); die "rewind error $status" if $status != AZ_OK; while (!$member->readIsDone()) { ($bufferRef, $status) = $member->readChunk(); die "readChunk error $status" if $status != AZ_OK && $status != AZ_STREAM_END; my $buffer = $lastChunk . $$bufferRef; while ($buffer =~ m{(.*$pattern.*\n)}mg) { print "$memberName:$1"; } ($lastChunk) = $$bufferRef =~ m{([^\n\r]+)\z}; } $member->endRead(); }