APM: running at 100% processor
Mike South
msouth at fulcrum.org
Tue Apr 1 15:04:20 CST 2003
>From austin-admin at mail.pm.org Tue Apr 1 13:11:34 2003
>
>Hi, I'm back again.
>
>I guess I figured out that Perl doesn't handle NULL cells in a database at all
>(other than spewing warnings everywhere). Does anybody have a clue why this
>would be?
>
Is your problem that you are getting NULLs out of the database, and
then trying to use the variables you stored them in as if there
were something in it? Can you show us the smallest snippet of code
that produces the warning, and the warning?
For example (untested code):
my ($fistname, $lastname) = $dbh->selectrow_array( 'select firstname, lastname from customers where id = 1 ' );
print "Hello, $fistname $lastname\n";
If, say, firstname is null for customer 1, that will produce a warning about
usingn an unintialized value in a string. To avoid that you could
do something like
$firstname = '' unless defined $firstname;
print "Hello, $fistname $lastname\n";
explicitly setting it to the empty string, rather than undef,
if it's undefined.
mike
More information about the Austin
mailing list