hi,
pls. find below my code for your perusal.
Also, i am using Active perl 5.8 which includes Archive::Zip
sskuse Archive::Zip; use Archive::Zip::MemberRead; opendir(DIR, "$ARGV[0]") || die "Can't open the '' directory"; @dr = grep(/\.zip/, readdir(DIR)); closedir(DIR); undef $/; foreach $ZipFilName (sort @dr) { my %ZipCnt = &Zip_XmlCount($ARGV[0]."\\".$ZipFilName); #### my required output print "$ZipCnt{'xml'}\t$ZipCnt{'pdf'}\t$ZipCnt{'title'}\n"; #### } sub Zip_XmlCount { my ($zipfile, $pdfCnt, $xmlCnt, %zipcnt) = @_; my $zip = Archive::Zip->new(); die "can't read '$zipfile' file" unless $zip->read($zipfile) eq 0; for($zip->memberNames()) { $xmlCnt++ if ($_ =~ /\.xml/is); # xml count $pdfCnt++ if ($_ =~ /\.pdf/is); # pdf count ########### problematic code $fh = new Archive::Zip::MemberRead($zipfile, "./$zpname"); while (defined($line = $fh->getline())) { $line =~ /<article-title>(.+)<\/article-title>/g; # articl +e-title inside xml file $title = $1; } ########### } $xmlCnt ||=0; $pdfCnt ||=0; $zipcnt{'xml'} = $xmlCnt; $zipcnt{'pdf'} = $pdfCnt; $zipcnt{'title +'} = $title; return %zipcnt; }
In reply to Re^2: problem with Zip::MemberRead
by ssk
in thread problem with Zip::MemberRead
by ssk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |