Folks,

I'm not sure what the problem is but I can't seem to get a valid return when
using  
$zip->writeToFileNamed().  It works when I zip a single file, but when I use
addTree() I get "Bad file descriptor".  Am I doing something wrong?

use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
        # FYI, I'm using Version : 1.22 of Zlib.pm per the FAQ

my $zip = Archive::Zip->new();
my $dir = 'c:/temp';

unlink ("$dir/xxx.zip") if ( -f "$dir/xxx.zip") ;

#
#       This works
#
# $member = $zip->addFile( 'y1.txt' );
# $zip->writeToFileNamed( 'someZip.zip' ) || die "ERROR $!" if $status !=
AZ_OK;

if ( -d "$dir/mydir" )  {
        my $result = $zip->addTree( "$dir/mydir", 'mydir1' );
        # I monitor this with filemon.exe and I do see it go through all the
dirs and files.
        print "result is: $result\n";

#       $result = $zip->writeToFileNamed("$dir/xxx.zip") || die "ERROR $!";
        ## This gives me: ERROR Bad file descriptor at archive.pl line 17
        # xxx.zip file exists and looks ok.

#       $result = $zip->writeToFileNamed("$dir/xxx.zip") || die "ERROR $!"
if $status != AZ_OK;
        # this does not die but also does not create a .zip

}


Any help would be appreciated,

Ben
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to