jamroll has asked for the wisdom of the Perl Monks concerning the following question:
the eval was added in as a suggestion to suppress the warning, but that doesn't work. $File::Fetch::WARN = 0 has no affect!use strict; use warnings; use CGI::Carp qw(fatalsToBrowser); use File::Copy; use File::Path qw(remove_tree rmtree); use File::Fetch; $File::Fetch::WARN = 0; use Fcntl; use URI::Escape; use English; my $ff = 0; eval { $ff = File::Fetch->new(uri => $PARAMS{url}); }; if (not $ff) { if ($DEBUG_OP_ADD_COVER_PHOTO) { $output .= "failed to retrieve image: " . $ff->error . "<br>\n"; } else { print error_redir(redirrer($OP_QUERY, $OP_FILE_MANAGER, $FOLDER_QU +ERY, $FOLDER), "Failed to Retrieve Image: " . $ff->error); exit 1; } }
the fetching process emits a completely different error message, and it's printed (i presume to STDOUT) before i get to print anything to STDOUT! which causes "internal server error", and i can't get the thing to stop printing that damn junk out, it 'breaks' things!
Note: whilst $DEBUG_OP_ADD_COVER_PHOTO = 1, the error message emitted is: could not retrieve file: Command failed:. Nowhere in my code have I asked for that to be printed out.Edit: Added "use" statements which may affect your answer. the code in this post is only a very small part of a much larger program.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: $File::Fetch::WARN = 0; not working?
by haukex (Archbishop) on Sep 12, 2019 at 19:37 UTC | |
by jamroll (Beadle) on Sep 12, 2019 at 20:25 UTC |