Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Edit Manifest file in jar archive

by almut (Canon)
on Jan 10, 2010 at 23:45 UTC ( [id://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;

    So,

    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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-19 10:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found