Thanks for the reply!
The first example... to make
newimage1.jpeg become branch/stick/image1.jpeg works correctly.
The second example, i.e. to remove
branch/stick/image1.jpeg and add
newimage1.jpeg under
branch/stick did not work. It removes the old image according to
removeMember but it does
not add
newimage1.jpeg to the archive.(using
addFile)
If I modify the
addFile line just to see if it will pack anything.. (I took out the directory path)
my $newmember = $zipFile->addFile( $newimage1, $newimage1);
It does not add the image to the archive directory either.
As mentioned by an anonymous monk... I posted above (
Re^3: Archive::Zip - what am I missing?), that if I do not use
my $newmember = $zipFile->addFile( $newimage1, "branch/stick/$newimage
+1");
but instead
my $oldimage1 = 'branch/stick/image1.jpeg';
my $newimage1 = Archive::Zip::Member->newFromFile( 'newimage1.jpeg' );
my $oldmember = $zipFile->replaceMember( $oldimage1, $newimage1 );
it packs
newimage1.jpeg into the archive but not into the correct directory.
I also tried...
my $oldmember = $zipFile->replaceMember( $oldimage1, "branch/stick/$ne
+wimage1" );
but it did not work either.
So to summarize.. it appears that the code below removes the original image (
image1.jpeg) but never adds the new image (
newimage1.jpeg) at all. Either with or without the archive directory name included. My understanding of the internals of the module is rather low but is this the excpected behaviour? :-)
my $oldimage1 = 'branch/stick/image1.jpeg';
my $newimage1 = 'newimage1.jpeg';
my $oldmember = $zipFile->removeMember( $oldimage1 );
my $newmember = $zipFile->addFile( $newimage1, "branch/stick/$newimage
+1");
my $oldimage1 = 'branch/stick/image1.jpeg';
my $newimage1 = Archive::Zip::Member->newFromFile( 'newimage1.jpeg' );
my $oldmember = $zipFile->removeMember( $oldimage1 );
my $newmember = $zipFile->addFile( $newimage1, "branch/stick/$newimage
+1");
regexes
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.