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)
In addition, when going in with a debugger, I find that the true cause is that localtime($time) returns an empty list if $time is -2147483648 (which is the minimum integer as calculated by the module).

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
But still, only on Windows. So I think I've found a bug. In Time::Local or localtime, I'm not sure. Not really relevant now - I just need to solve this.

Finally, the question: how do I turn off warnings for another module? I've tried:

{ no warnings; no strict; no diagnostics; use Time::Local; }
but it hasn't had any affect. Is there another option? Thanks!


In reply to Time::Local and warnings by Tanktalus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.