I'm currently writing a module that uses Time::Local. In particular the timelocal() function. Now I also want to use dates before the epoch, the example I'm using is 13th September 1965 (a significant date in my calendar :)). On Linux this gives me the correct value with no problem. However, running on Windows via the test suite I get a whole host of error messages, although standalone it just reports the value correctly.
So I decided to have a look at what is going on inside timelocal(). Unfortunately the culprit seems to be localtime(). With negative values it prints nothing. Thankfully Time::Local can cope with this and still returns a valid negative number.
My problem now is how do I stop these warnings of "Use of uninitialized value in integer addition..." etc while running my tests? Bear in mind this a Perl function running from a Perl Core module.
Do I simply not allow tests of dates before the epoch if running on Windows (I'd rather not have to do that *), or is there some way I can tell localtime the world is not going to end or perhaps a switch for the test harness that can suppress them? Or is there another way?
* Though I note that Time::Local ignores dates before the epoch in tests ... hmmm, I wonder why.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Barbie
Birmingham Perl Mongers
Web Site: http://birmingham.pm.org/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.