Alan Haggai Alavi wrote:
Hi,
Why is this bug being caused:
http://rt.cpan.org/Public/Bug/Display.html?id=25726 ?
The problem is that the forked child is unable to create a zip archive,
whereas the parent is able to do so. In GNU/Linux, zip archives can be
created from both the parent as well as the child.
The code isn't creating an archive, it's extracting from it.
Seems to run OK on Windoze for me (see my more verbose version below).
Why is it so?
You'll need to be more explicit in what you think is failing.
Run on 5.8.8 (B820):
Exiting parent
Archive read OK
Extract OK
Exiting child
Code:
#!perl --
use strict;
use warnings;
use Archive::Zip qw(:ERROR_CODES);
my $path = 'E:/zips/my.zip'; # zip with 2 files
my $tmp = 'E:/tmp';
my $child = fork;
if ($child == 0) {
chdir $tmp or die "chdir $tmp: $! ($^E)";
my $z = Archive::Zip->new;
if ($z->read($path) == AZ_OK) {
print "Archive read OK\n";
} else {
die "Failed to read\n";
}
if ($z->extractTree == AZ_OK) {
print "Extract OK\n";
} else {
die "failed to extract\n";
}
print "Exiting child\n";
} else {
print "Exiting parent\n";
}
exit;
__END__