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.
In reply to Re: Perl Archiving Process error
by Eily
in thread Perl Archiving Process error
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |