Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Edit Manifest file in jar archive

by almut (Canon)
on Jan 10, 2010 at 23:45 UTC ( #816659=note: print w/replies, xml ) Need Help??

in reply to Edit Manifest file in jar archive

$zip->replaceMember( 'MANIFEST.MF', $file );

Maybe try instead

$zip->replaceMember( 'META-INF/MANIFEST.MF', $file );

Also, it seems (though the docs are somewhat ambiguous) the method wants a member object for the new member, not a file name, so try  (untested)

... my $new_member = Archive::Zip::Member->newFromFile($file); $zip->replaceMember( 'META-INF/MANIFEST.MF', $new_member);

If that doesn't work either, what's the return value of replaceMember()? (according to the docs, it returns undef on error)

Replies are listed 'Best First'.
Re^2: Edit Manifest file in jar archive
by ReturnOfThelonious (Beadle) on Jan 11, 2010 at 05:04 UTC
    This is almost right, but then the zip file will contain a file 'MANIFEST.MF' instead of 'META-INF/MANIFEST.MF'. I think updateMember will work, though. Also, you need to close FH;


    close FH or die "error writing $file: $!\n"; $zip->updateMember('META-INF/MANIFEST.MF', $file) or die "updateMember";
Re^2: Edit Manifest file in jar archive
by jonnyfolk (Vicar) on Jan 11, 2010 at 14:16 UTC

    Thanks very much for your input. This is definitely on the right lines - it is getting the required file into the app but in the wrong place!!

    I have an empty META-INF directory (so Manifest file is being deleted, but alongside that (in the main directory) the MANIFEST.MF file. I will now need to discover how to move the file into the directory. Thank you once again.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://816659]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2018-12-10 12:06 GMT
Find Nodes?
    Voting Booth?
    How many stories does it take before you've heard them all?

    Results (48 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!