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

I have this part of admin.pl script which checks one param of referer script called param('Apostoli!);
############################################################## my $action = param('action'); #============ REDIRECT TO PROPER SCRIPT =================== if( ($action eq 'Apostoli') && ($ENV{HTTP_REFERER} =~ / index/) ) ##############################################################
and iam gettign thsi error now: Fri Apr 27 22:28:11 2007 error client 10.0.0.2 Fri Apr 27 22:28:11 2007 admin.pl: Use of uninitialized value in string eq at D:\ \www\\cgi-bin\\admin.pl line 26., referer: http://dell/

Line 26 is the line with if. All this happened when i deleted the d:\www\index.html file which was pointing to d:\www\cgi-bin\index.pl through a javascipt call and set apache to load /cgi-bin/ index.pl directly when http://localhost.

Replies are listed 'Best First'.
Re: Weird error after a configuration change
by jdporter (Paladin) on Apr 27, 2007 at 20:56 UTC

    You should probably test all scalars (both $action and $ENV{HTTP_REFERER}, in this case) for defined-ness before doing string tests on them.

    However, 'Use of uninitialized value' is not an error, it's a warning. You should probably also ensure that http headers are being issued by your program before any other output, so that warning messages such as this don't cause CGI/HTTP errors.

    A word spoken in Mind will reach its own level, in the objective world, by its own weight
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Weird error after a configuration change
by shigetsu (Hermit) on Apr 27, 2007 at 20:55 UTC

    My guess is that

    my $action = param('action');
    yields an undefined value, thus
    $action eq 'ΑποστοΠ+»Ξ®!'
    is responsible for the "uninitialized value in string eq" warning.

    Are you sure your index.pl is being invoked with the same query string as before?

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Weird error after a configuration change
by blazar (Canon) on Apr 29, 2007 at 19:55 UTC
    Line 26 is the line with if. All this happened when i deleted the d:\www\index.html file which was pointing to d:\www\cgi-bin\index.pl through a javascipt call and set apache to load /cgi-bin/ index.pl directly when http://localhost.

    Once again, why don't you say that you posted the very same question in clpmisc? (link @ GG.)

    A reply falls below the community's threshold of quality. You may see it by logging in.