PERL BEGINNERS 6 RE ARCHIVE ZIP FUNNNY RETURN STATUS
Subject: RE: Archive::Zip funnny return status
Date: Tue, 5 Aug 2003 15:38:45 -0700

From: tjohnson@no-spam (Tim Johnson)

I think your pattern match will only catch a literal AZ_OK, not the constant. And I'm not sure, but AZ_OK might evaluate to 0. At least I think I remember having trouble with that module because it returns 0 on success, and I kept testing for TRUE/FALSE based on the return status.

-----Original Message-----




















From: Dan Muey [mailto:dmuey@no-spam
Sent: Tuesday, August 05, 2003 2:32 PM To: beginners@no-spam
Subject: Archive::Zip funnny return status

use Archive::Zip;
...
my $member = $zip->memberNamed($zippedfile);
my $rc = $member->extractToFileNamed($unzippedfile);
if($rc =~ m/AZ_OK/) { print "ok -$rc-\n; } else { print "Bad -$rc-\n"; }

The code above *always* prints:
Bab -0-

But $unzippedfile is created properly, everytime, even if I delete it first and run it again!!! So shouldn't $rc have AZ_OK in it or even better be 1 on success? Or is writing the text file in the zip archive to a local text file not success? What could I be doing wrong/missing?

TIA
Dan
-- To unsubscribe, e-mail: beginners-unsubscribe@no-spam For additional commands, e-mail: beginners-help@no-spam