Hi. I am fairly new to perl and its fair to say I am not a developer by profession. I am having an issue and can not fanthom how to resolve or workaround...
on my Linux box I have zip files and want to find out the contents. for example;
[myuser@dev2 ~]# file /tmp/test.zip /tmp/test.zip: Zip archive data, at least v2.0 to extract [myuser@dev2 ~]# unzip -l /tmp/test.zip Archive: /tmp/test.zip Length Date Time Name -------- ---- ---- ---- 19855954 08-24-10 17:06 RGB_DSC08815.jpg 11230988 08-24-10 17:05 RGB_fly43337.jpg 13285985 08-24-10 17:04 RGB_fly48151.jpg 10024136 08-24-10 17:04 RGB_fly48168.jpg 9236336 08-24-10 17:04 RGB_fly54598.jpg 7750448 08-24-10 17:03 RGB_fly57173.jpg 8870833 08-24-10 17:03 RGB_MHowell142.jpg 10178959 08-24-10 17:06 RGB_MHowell181.jpg 1151658 08-24-10 17:16 RGB_Ducky_HARD.eps 14741504 09-07-10 17:08 RGB_TEST.indd -------- ------- 106326801 10 files
but when I use the perl code below I get the error.
[myuser@dev2 ~]# ./showZipContents.pl RGB_DSC08815.jpg RGB_fly43337.jpg Error processing /tmp/test.zip:
Here i my code so far.
#!/usr/bin/perl -w use strict; use warnings; use IO::Uncompress::Unzip qw(unzip $UnzipError); my $zipfile = "/tmp/test.zip"; my $u = new IO::Uncompress::Unzip $zipfile or die "Cannot open $zipfile: $UnzipError"; my $status; for ($status = 1; ! $u->eof(); $status = $u->nextStream()) { my $filename = $u->getHeaderInfo()->{Name}; print "$filename\n" ; } die "Error processing $zipfile: $!\n" if $status < 0 ;
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |