in reply to Explain Archive::Zip to me please?

You probably want something like the following:
use strict; use Archive::Zip; #read the .jar file my $zip = Archive::Zip->new( 'helloworld.jar' ); # extract what you want my $file = "content/helloworld/helloworldOverlay.js"; my $member = $zip->extractMember($file); # do something with the file $file # now add it back $zip->removeMember($member); $zip->addFile($file); $zip->overwrite();

Replies are listed 'Best First'.
Re^2: Explain Archive::Zip to me please?
by Cody Pendant (Prior) on Sep 11, 2005 at 07:16 UTC
    Hi, thanks, that was almost exactly it. This does what I wanted:
    my $zip = Archive::Zip->new( 'browser.jar' ) || die "$!"; # extract what you want my $file = "content/browser/browser.js"; $zip->extractMember($file); # Edit the file as necessary, # which is at ./content/browser/browser.js # now add it back $zip->removeMember($file); $zip->addFile($file); $zip->overwrite();

    The extractMember function actually does extract a tree, as in, it extracts whatever directories are necessary to mirror that one file and its enclosing directories. So the file is there in the current working directory, inside the portion of the tree where it was located in the zip file.



    ($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
    =~y~b-v~a-z~s; print