I just added an Intermediate Windows Skills course to our curriculum at the library, and one of the topics covered is software installation, and so something to extract ZIP files is needed, so that the participants can have practice installing software that comes packaged in a ZIP file. As I was checking the computers we use for the courses to make sure they're ready, I noticed one Win98 machine didn't have a simple ZIP file extractor. (It did have something, but it wasn't something I wanted to explain the use of within the course.) I tried installing PKWare's Reader, but it complained about a misssing DLL. I didn't feel like messing with it, and I remembered that I already had Archive::Zip installed on there (because it's used by the word search maker for creating an OpenOffice document), and so I just associated ZIP files with this simple Perl script:

#!/usr/bin/perl use Archive::Zip; for (@ARGV) { print "Unzipping: $_\n" if $debug; my $zip = Archive::Zip->new($_) or die "Unable to open $_: $!"; for my $m ($zip->members()) { print " Member: ".Dumper($m)."\n" if $debug; # $m is an object of class Archive::Zip::ZipFileMember print " ".$m->fileName()."$/"; $zip->extractMember($m); } }

This doesn't have a lot of features, but it does what we need for this course (double-click a ZIP file in Windows Explorer, and its contents are spilled out on the spot), and writing and installing it was faster than trying to solve the problem with the PKWare Reader.


$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/

In reply to Simple ZIP extractor by jonadab

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.