Jon Nelson on 1 Dec 2010 07:09:09 -0800

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Stupid Perl/CGI Questions

On Wed, Dec 1, 2010 at 9:25 AM, Kyle R. Burton <> wrote:
> I am sure there has to be an easy fix for my problem, but my googling has
> not been fruitful.  This page has rendered without error in the past, but
> now will not and I get the following error repeated 9 times:
>     [Tue Nov 30 15:45:22 2010] driveInfo.cgi: Use of uninitialized value in
> concatenation (.) or string at (eval 25) line 23.

This sounds like a warning (enabled either via -w or 'use warnings' --
which I recommend, along with 'use strict' in _all_ of your perl
programs).  Did the warning switch get changed recently? 

The only thing that changed is that I went from  Knoppix to a Ubuntu bootCD.  All the code has remained the same.

> Line 23 is in the middle of my opening comments in driveInfo.cgi so what
> does "(eval 25) line 23" mean?.  As far as I can tell the offending code is:

The 'eval' is an indication that the code being executed isn't
directly from a perl program or module (IIRC).  Are you using some
kind of HTML templating system?  If you are, then those line numbers
are likely relative to the start of the embedded block of perl code.

driveInfo.cgi calls a routine from to render the radio button group.  The code shown below is actually from  I used the debugger to try to determine the offending code and this is where the errors occurred.

> <code>
>  print $cgi->radio_group(-name      => 'search',
>                             -values    => ["getImages",
>                                            "recentFiles",
>                                            "desktop",
>                                            "regInfo",
>                                            "netSearch",
>                                            "ffInfo",
>                                            "google",
>                                            "usbInfo",
>                                            "p2pInfo"],
>                             -default   => 'foo',
>                             -linebreak => 'true',
>                             -labels    => {getImages => "Find Images &
> Movies",
>                                            recentFiles => "Recently Viewed
> Files",
>                                            desktop => "Desktop Files",
>                                            regInfo => "Windows System
> Information",
>                                            netSearch => "Internet Explorer
> History",
>                                            ffInfo => "Firefox History",
>                                            google => "Google Toolbar
> Searches",
>                                            usbInfo => "USB Device
> Information",
>                                            p2pInfo => "P2P & Password File
> Collection"});
> </code>
> I have tried storing the labels in a hash, but got the same results.  Any
> ideas?

I don't understand how this code could be the cause of 9 warnings - it
only has 1 var that could be uninitialized : $cgi and if it was you'd
get a different error, something along the lines of 'cant call
radio_group on undefined value'.

I was of the same mindset, until I ran the debugger.  With the above code there are 9 key - value pairs and 9 errors.  I have one other radio button that is generated and it has one key - value pair and one error associated with it.

Thanks for the help!


The line numbers in the warnings/errors not lining up with the actual
code could also be an indication that the code that's being run by the
web server isn't the same as the code you're looking at?

Is this part of a template?



> If I run the script from the command line I get the HTML I was expecting,
> but it doesn't render when run from the server.  Is that due to the above
> errors?
> Thanks,
> Jon
> ___________________________________________________________________________
> Philadelphia Linux Users Group         --
> Announcements -
> General Discussion  --

Twitter: @kyleburton
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --

Philadelphia Linux Users Group         --
Announcements -
General Discussion  --