> Hola, > > How do I remove a file from a zip file and add it to a different existing archive? From the Archive_Zip documentation I understand that I'm clobbering the existing archives when i use the code below. How do I not clobber them? > > thank you. > > > use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); > > my $from_zip = Archive::Zip->new(); > my $to_zip = Archive::Zip->new();
You don't confirm that new was actually successful. I couldn't see how it indicates errors. You also haven't added anything to the Archive::Zip objects above, like a file, are you sure the object has members to begin with? > my $member = $from_zip->removeMember( '000002031_02498_02498_policy_o1_2775057.pdf' ); > $to_zip->addMember( $member ); > This looks right, but again you aren't doing any error checking to see if something has gone wrong, it might indicate what your problem is. > die 'write error' unless $from_zip->writeToFileNamed( 'INITIAL_2498_20040514_1.zip' ) == AZ_OK; > die 'write error' unless $to_zip->writeToFileNamed( 'INITIAL_2498_20040514_2.zip' ) == AZ_OK; > Is this real code? If not, show us, that we might be able to provide more help. If this is real code you are going to need to read the zip file into the 'from' object... http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
