peterr has asked for the wisdom of the Perl Monks concerning the following question:

I would like some advise please, about warning errors that are being logged. The 'shebang' line and modules

#!/usr/bin/perl -wT use CGI qw/:standard/; use DBI; use Net::SMTP; use CGI::Carp qw(fatalsToBrowser); BEGIN { use CGI::Carp qw(carpout); open(LOG, ">>/home/username/cgi-bin/mycgi-log") or die("Unable to open mycgi-log: $!\n"); carpout(LOG); } # resource limits $CGI::DISABLE_UPLOADS = 1; $CGI::POST_MAX = 1024;

The first line in the log file

Unquoted string "footer" may clash with future reserved word at line 714.

print footer;

So, I will call it "page_footer" or something I guess.

The next line in the log file

Unquoted string "break" may clash with future reserved word at line 716.

sub check_value_combinations { diehtml($comb_error) if defined $comb_error; print footer; break; }

Is this one caused by the footer problem, or , if not, what else do I put in place of the 'break' ?

Name "main::LOG" used only once: possible typo at line 10.

BEGIN { use CGI::Carp qw(carpout); open(LOG, ">>/home/username/cgi-bin/mycgi-log") or die("Unable to open mycgi-log: $!\n"); carpout(LOG); }

Line 10 , is the "open(LOG, .." code

Use of uninitialized value in concatenation (.) or string at line 256.

print "<form><input type=\"hidden\" name=\"confirmed\" value=\"yes\">" +; print "<input type=\"hidden\" name=\"name\" value=\"$name\"> <input type=\"hidden\" name=\"surname\" value=\"$company\">

Line 256 is the second PRINT command, and there are many input lines, the last is finished with a \n"; . The var $name is defined early in the form

$name = cgi_get('name') and $name =~ s/'`-\w\s//go; # filter name

The only other question I had concerning the script is, just after the 'shebang' line, there is the use of modules Net::SMTP and CGI::Carp , which of course are needed, but what are the other modules used for, and the 'resource limits' code

use CGI qw/:standard/; use DBI; # resource limits $CGI::DISABLE_UPLOADS = 1; $CGI::POST_MAX = 1024;

Should anything be changed in the above code, or additional lines needed ?

Thanks, :)

Peter

Replies are listed 'Best First'.
Re: Action needed on warning errors ?
by Roger (Parson) on Oct 07, 2003 at 04:34 UTC
    Change your line of
    print footer;
    to this
    print &footer;
    And the warning will go away.
      Better yet, change it to print footer(); unless you know exactly why you would use &footer instead.
      Thanks, your suggestion caused me to search for string 'footer' in the code. Actually there is a sub called "page_footer", but no sub called "footer". Then more digging thru the code, and the sub where "print footer" is, the call to it, has been commented out.

      # &check_value_combinations;

      It's a huge Perl script, written by someone else, so I'm still learning. :)

      Thanks,

      Peter

        The best idea is to add use strict; to the top and fix everything it complains about.