jvector has asked for the wisdom of the Perl Monks concerning the following question:
Monks,
I am sure this should not be complicated:
#!/usr/bin/perl use strict; use warnings; use diagnostics; use Getopt::Std; use DBI; use DateTime; use FileHandle; use Socket; use lib q(/home/dds/utils); use DDSUtils; # a few 'my $thisNthat;'s ... print "$0: ",(scalar localtime), "\n"; # do stuff... print "$0: " ,(scalar localtime), " run complete\n"; $Odbh->disconnect; exit;
Compiles OK, but when it runs:
qg@dev:~/svnwork/dds/trunk/src$ ./alerts.pl ./alerts.pl: Tue Oct 21 11:32:20 2008 ./alerts.pl: Tue Oct 21 11:32:21 2008 run complete Use of uninitialized value in require at /usr/share/perl/5.8/AutoLoade +r.pm line 92 during global destruction (#1) (W uninitialized) An undefined value was used as if it were alread +y defined. It was interpreted as a "" or a 0, but maybe it was a mi +stake. To suppress this warning assign a defined value to your variables. To help you figure out what was undefined, perl tells you what ope +ration you used the undefined value in. Note, however, that perl optimiz +es your program and the operation displayed in the warning may not necessa +rily appear literally in your program. For example, "that $foo" is usually optimized into "that " . $foo, and the warning will refer +to the concatenation (.) operator, even though there is no . in your program.
It now gets interesting ... As I was composing this node I thought "these monks don't want to see the long diagnostic explanation of the warning - I'll comment out the 'use diagnostics;' and just get the brief warning"...
qg@dev:~/svnwork/dds/trunk/src$ !! ./alerts.pl ./alerts.pl: Tue Oct 21 11:32:53 2008 ./alerts.pl: Tue Oct 21 11:32:54 2008 run complete qg@dev:~/svnwork/dds/trunk/src$
The only difference between the two runs is that I commented out the
line. But it seems to have made the warning go away.use diagnostics;
¿Qué pasa?
|
|---|