Perl Problem
Scott Penrose
scottp at dd.com.au
Mon Sep 8 21:01:10 CDT 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tuesday, Sep 9, 2003, at 11:25 Australia/Melbourne, Rick Measham
wrote:
> As everyone seems to be hanging around this morning, let me post a
> programming question:
>
> Given that $locations is a ref returned from DBI's
> $dbh->selectall_arrayref():
>
> foreach my $location (@{$locations}) {
> next unless @{$location};
> print join("\t", @{$location}) . "\n";
> }
>
> Why does my app hang and then exactly 5 minutes later fill my apache
> error_log with 120 lines of:
>
> [Tue Sep 09 11:13:05 2003] [error] [client 10.0.0.181] Use of
> uninitialized value in join or string at ./modules/Location.pm line
> 342.
No idea why it is hanging, very odd... You could try adding in "print
STDERR" lines in your code which will go into the logs time stamped so
you can see WHERE it is blocking. Or you can use Devel::PTKDB to debug
it visually.
As for the unitialized value, only ONE of the entries returned in your
array and you will get that each time. So for example you have 120
lines, which suggests maybe 4 of the returned entries are NULL which
equate to undef in perl after coming through DBI.
> The select when pasted into psql returns 33 rows, so I'm not sure
> what's going on here...
>
> Any help muchly appreciated.
>
> Cheers!
> Rick Measham
Scott
- --
Scott Penrose
Welcome to the Digital Dimension
http://www.dd.com.au/
scottp at dd.com.au
Dismaimer: Contents of this mail and signature are bound to change
randomly. Whilst every attempt has been made to control said
randomness, the author wishes to remain blameless for the number of
eggs that damn chicken laid. Oh and I don't want to hear about
butterflies either.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (Darwin)
Comment: For info see http://www.gnupg.org
iD8DBQE/XTRqDCFCcmAm26YRAnxuAJ0YAulSYDRekfaCf3jY6LdgxVTm/QCfZ0PC
dYyQoL0fQPE6nzimlwLQTlE=
=5eOd
-----END PGP SIGNATURE-----
More information about the Melbourne-pm
mailing list