Tanktalus has asked for the wisdom of the Perl Monks concerning the following question:
The wonderful thing about explaining a problem is how much you can learn about it by trying to tell someone else about it. I was in the middle of typing this SoPW and about to claim "I can't pare this down." And then I figured out a really simple, minimal example that exhibits the problem.
The system: Windows running ActiveState 5.8.6. Note that 5.8.6 running on other platforms, thus far, have not exhibited this problem which is annoying because Windows is the only platform where I need to run this piece of code. (I'm not sure why this is.)
The problem: convert a timestamp, e.g., 2005-07-15, to a epoch-time for futher manipulations.
The symptoms:
Use of uninitialized value in integer addition (+) at E:/build/SDKs/perl5.8.6/lib/Time/Local.pm line 76 (#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. Use of uninitialized value in integer multiplication (*) at E:/build/SDKs/perl5.8.6/lib/Time/Local.pm line 76 (#1) Use of uninitialized value in pack at E:/build/SDKs/perl5.8.6/lib/Time +/Local.pm line 67 (#1) Use of uninitialized value in integer addition (+) at E:/build/SDKs/perl5.8.6/lib/Time/Local.pm line 68 (#1) Use of uninitialized value in integer addition (+) at E:/build/SDKs/perl5.8.6/lib/Time/Local.pm line 69 (#1) Use of uninitialized value in integer addition (+) at E:/build/SDKs/perl5.8.6/lib/Time/Local.pm line 67 (#1)
However. This is not a problem if I use Time::Local all by itself. For example, perl -MTime::Local -e "print timelocal(0,0,0,15,6,2005),$/" works just perfectly. So obviously I'm doing something in another module to screw it up.
What am I doing to screw it up? Well, the astute reader will note that these are all mere warnings. And that my example above didn't turn on warnings. And, of course, the clincher is the title of this node. :-)
If I use perl -MTime::Local -we "print timelocal(0,0,0,15,6,2005),$/", I get:
Use of uninitialized value in integer addition (+) at E:/build/SDKs/pe +rl5.8.6/lib/Time/Local.pm line 76. Use of uninitialized value in integer multiplication (*) at E:/build/S +DKs/perl5.8.6/lib/Time/Local.pm line 76. Use of uninitialized value in integer multiplication (*) at E:/build/S +DKs/perl5.8.6/lib/Time/Local.pm line 76. Use of uninitialized value in pack at E:/build/SDKs/perl5.8.6/lib/Time +/Local.pm line 67. Use of uninitialized value in pack at E:/build/SDKs/perl5.8.6/lib/Time +/Local.pm line 67. Use of uninitialized value in integer addition (+) at E:/build/SDKs/pe +rl5.8.6/lib/Time/Local.pm line 68. Use of uninitialized value in integer addition (+) at E:/build/SDKs/pe +rl5.8.6/lib/Time/Local.pm line 69. Use of uninitialized value in integer addition (+) at E:/build/SDKs/pe +rl5.8.6/lib/Time/Local.pm line 67. 1121407200
Finally, the question: how do I turn off warnings for another module? I've tried:
but it hasn't had any affect. Is there another option? Thanks!{ no warnings; no strict; no diagnostics; use Time::Local; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Time::Local and warnings
by borisz (Canon) on Aug 04, 2005 at 18:59 UTC | |
by Tanktalus (Canon) on Aug 04, 2005 at 20:13 UTC | |
|
Re: Time::Local and warnings
by NetWallah (Canon) on Aug 04, 2005 at 19:06 UTC | |
by Tanktalus (Canon) on Aug 04, 2005 at 20:17 UTC | |
|
Re: Time::Local and warnings
by sgifford (Prior) on Aug 04, 2005 at 19:14 UTC | |
|
Re: Time::Local and warnings
by PodMaster (Abbot) on Aug 05, 2005 at 06:04 UTC | |
by deibyz (Hermit) on Aug 05, 2005 at 11:18 UTC | |
by PodMaster (Abbot) on Aug 05, 2005 at 12:51 UTC |