SPUG: Unitialized values
Aryeh "Cody" Sherr
asherr at cs.unm.edu
Thu Jun 1 18:26:03 CDT 2000
Peter,
first of all, if you are ever wanting better warnings,
use diagnostics; # spits out better messages
also, the camel book has all of the warnings in an appendix, and what they
mean.
If those param() values are undefined, I'd guess that param returns undef,
which the eq operator compares to something, so it complains.
You could get around this with using the defined parameter to check if
that value is defined before you start using it like it was.
if ( defined(param("foo")) && param("foo") eq ....
This is why I don't use -w at runtime anymore, although you can
apparently turn certain warnings off (such as this one) in 5.6.
Cody
On Thu, 1 Jun 2000, Peter Darley wrote:
>Friends,
> I have a script that is always throwing up warnings, and I can't
>for the life of me figure out what it's warning me about. I tried to
>find a description of the error in the perl man pages, but I'm still
>pretty new to it and didn't have any luck. Anyone have any ideas? The
>code is as follows, minus its subs (I added the numbering for
>reference):
>
>1 #!/usr/bin/perl -w
>2
>3 ###############################################
>4 #
>5 # Page for setting up a new data source.
>6 # It does several things:
>7 # 1) Collects information about what client it goes too, what the
>name of it is, and gets the text file that contains the data
>8 # 2) Collects information about the structure of the data
>9 # 3) Imports data according to it's structure
>20 #
>11 ###############################################
>12
>13 use strict;
>14 use CGI qw(:standard);
>15 use DBI;
>16
>17 require "./DashboardLib.pl";
>18
>19 my $dbSystem =
>DBI->connect("DBI:mysql:database=Development;host=localhost","root","");
>20
>21
>22 #Start Main
>23 print header();
>24
>25 if (param('Action') eq 'GetTableStructure') {print
>GetTableStructure($dbSystem)}
>26 elsif ((param('Action') eq 'StartImport') || (!param())) {print
>StartImport($dbSystem)};
>27
>28 $dbSystem->disconnect();
>29 #End Main
>
> The errors that I'm getting are:
>
>Use of uninitialized value at /usr/local/apache/cgi-bin/SetupDB.pl line
>25.
>Use of uninitialized value at /usr/local/apache/cgi-bin/SetupDB.pl line
>26.
>
> Any help y'all could provide would be much appreciated.
>Thanks,
>Peter Darley
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
> Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
> For Subscriptions, Email to majordomo at pm.org: ACTION spug-list EMAIL
> Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address
>
>
>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
For Subscriptions, Email to majordomo at pm.org: ACTION spug-list EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address
More information about the spug-list
mailing list