luxs has asked for the wisdom of the Perl Monks concerning the following question:
and the output is "Attempt to uncompress empty string at ....." with crashing of script without EVAL or continuing with EVAL How to handle this error and do not output any default messages? BUT! if the file is not empty but not proper format - in this case this script hanle error correctly!use Gzip::Faster; my $gz = ''; my $data; eval { $data = gunzip( $gz ); }; if ($@) { say "can't unzip file"; exit; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: gunzip exception
by choroba (Cardinal) on Feb 08, 2021 at 09:41 UTC | |
by luxs (Beadle) on Feb 08, 2021 at 10:44 UTC | |
|
Re: gunzip exception
by Corion (Patriarch) on Feb 08, 2021 at 08:52 UTC | |
by luxs (Beadle) on Feb 08, 2021 at 10:38 UTC | |
|
Re: gunzip exception
by choroba (Cardinal) on Feb 08, 2021 at 10:52 UTC | |
by luxs (Beadle) on Feb 08, 2021 at 11:24 UTC | |
by Corion (Patriarch) on Feb 08, 2021 at 11:31 UTC | |
by luxs (Beadle) on Feb 08, 2021 at 11:54 UTC | |
|
Re: gunzip exception
by tybalt89 (Monsignor) on Feb 08, 2021 at 15:33 UTC | |
|
Re: gunzip exception
by 1nickt (Canon) on Feb 09, 2021 at 01:56 UTC |