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

Re: [Omaha.pm] silly warnings



Just to follow-up on my previous e-mail, here are my results and a test case.

I added the "no warnings qw(uninitialized)" jusst before my line 57, but left out the "use warnings qw(uninitialized)" as Jay suggested and it worked like a charm.

In another section of code, I had similar warnings but that code called a few other subroutines.  I setup this code to test if the "no use warnings" would carry over to the subroutine:

dan:/tmp$ cat d30.pl
#!/usr/bin/perl
use warnings;
sub myfunc {
  $f1 = 123;
}
$x = 10;
for (1..1) {
  no warnings;
  $y = 10;
  $funcreturn = myfunc();
}
$z = 10;

dan:/tmp$ ./d30.pl
Name "main::f1" used only once: possible typo at ./d30.pl line 6.
Name "main::z" used only once: possible typo at ./d30.pl line 15.
Name "main::x" used only once: possible typo at ./d30.pl line 9.
dan@dglaptop:PerlTests$

The "no warnings" does not carry out of the current block of code into the subroutine (I got the "main::f1 used only once").

Thanks for the input everyone,

Dan

--
"Quis custodiet ipsos custodes?" (Who can watch the watchmen?) -- from the Satires of Juvenal
"I do not fear computers, I fear the lack of them." -- Isaac Asimov (Author)
** *** ***** ******* *********** *************