What's the best way to stop undefined warnings for code like this:

$data->{'image'} = CopyTempFile('image') if ($main::global->{'admin'} && 
$main::global->{'form'}->{'image_upload'} ne '');

        CGI::Carp gives the following:

[Tue Jun 17 14:54:36 2014] admin.cgi: Use of uninitialized value in string ne 
at admin.cgi line 219.

        I know that I can surround the section with 
{ 
no warnings 'uninitialized';
...
}

or I could add a check for defined-ness as follows:

$data->{'image'} = CopyTempFile('image') if ($main::global->{'admin'} && 
defined $main::global->{'form'}->{'image_upload'} && 
$main::global->{'form'}->{'image_upload'} ne '');

        Is there a better way to stop this warning in situations like this?  
I'd like to keep these warnings from filling up the log.

Thanks,
Frank

http://www.surfshopcart.com/
Setting up shop has never been easier!


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to