in reply to Perl Archiving Process error
The error is pretty explicit. $newMember is undef.
You can either check that the $newMember is defined before calling a method on it:
warn "Error while archiving file $fileName to $newName" and return unless defined $newMember
or catch the error with an eval
eval { $newMember->desiredCompressionLevel($compressionLevel); 1; } or warn "Error for file $fileName, $newName : $@" and return;
eval will return the last instruction (here 1) if it executes correctly or undef if an error is raised. So with the idiom eval { THING; 1; } a true value will be returned on success.
does the same thing by checking the state of the variable $@.eval { THING }; warn if $@;
Once you have found which file is a problem, you'll have to find out why newFromFile() returns undef in that case.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl Archiving Process error
by choroba (Cardinal) on Jul 12, 2016 at 13:14 UTC | |
by Eily (Monsignor) on Jul 12, 2016 at 13:24 UTC |