<p>This has me puzzled. This code worked on another server, but it's failing on Perl v5.8.8 with <a href="http://search.cpan.org/dist/Date-Manip" rel="nofollow noreferrer">Date::Manip</a> loaded from CPAN today.</p>

<pre><code>Warning:
Use of uninitialized value in numeric lt (&lt;) at /home/downside/lib/Date/Manip.pm line 3327.
at dailyupdate.pl line 13
        main::__ANON__('Use of uninitialized value in numeric lt (&lt;) at
/home/downsid...') called at
/home/downside/lib/Date/Manip.pm line 3327
        Date::Manip::Date_SecsSince1970GMT(09, 16, 2008, 00, 21, 22) called at
/home/downside/lib/Date/Manip.pm line 1905
        Date::Manip::UnixDate('today', '%Y-%m-%d') called at
TICKER/SYMBOLS/updatesymbols.pm line 122
        TICKER::SYMBOLS::updatesymbols::getdate() called at
TICKER/SYMBOLS/updatesymbols.pm line 439
        TICKER::SYMBOLS::updatesymbols::updatesymbol('DBI::db=HASH(0x87fcc34)',
'TICKER::SYMBOLS::symbol=HASH(0x8a43540)') called at
TICKER/SYMBOLS/updatesymbols.pm line 565
TICKER::SYMBOLS::updatesymbols::updatesymbols('DBI::db=HASH(0x87fcc34)', 1, 0, -1) called at
dailyupdate.pl line 149
        EDGAR::updatesymbols('DBI::db=HASH(0x87fcc34)', 1, 0, -1) called at
dailyupdate.pl line 180
        EDGAR::dailyupdate() called at dailyupdate.pl line 193
</code></pre>

<p>The code that's failing is simply:</p>

<pre><code>sub getdate()
{    my $err;                ## today
    &amp;Date::Manip::Date_Init('TZ=EST5EDT');       
    my $today = Date::Manip::UnixDate('today','%Y-%m-%d'); ## today's date
    ####print "Today is ",$today,"\n";        ## ***TEMP***
    return($today);
}
</code></pre>

<p>That's right; <a href="http://search.cpan.org/dist/Date-Manip" rel="nofollow noreferrer">Date::Manip</a> is failing for <code>"today"</code>.</p>

<p>The line in <a href="http://search.cpan.org/dist/Date-Manip" rel="nofollow noreferrer">Date::Manip</a> that is failing is:</p>

<pre><code>  my($tz)=$Cnf{"ConvTZ"};  
  $tz=$Cnf{"TZ"}  if (! $tz);  
  $tz=$Zone{"n2o"}{lc($tz)}  if ($tz !~ /^[+-]\d{4}$/);  

  my($tzs)=1;  
  $tzs=-1 if ($tz&lt;0); ### ERROR OCCURS HERE  
</code></pre>

<p>So <a href="http://search.cpan.org/dist/Date-Manip" rel="nofollow noreferrer">Date::Manip</a> is assuming that <code>$Cnf</code> has been initialized with elements <code>"ConvTZ"</code> or <code>"TZ"</code>.  Those are initialized in <code>Date_Init</code>, so that should have been taken care of.</p>

<p>It's only failing in my large program.  If I just extract "<code>getdate()</code>" above
and run it standalone, there's no error.  So there's something about the
global environment that affects this.</p>

<p>This seems to be a known, but not understood problem.  If you search Google for
"Use of uninitialized value date manip" there are about 2400 hits.
This error has been reported with <a href="http://www.lemis.com/grog/videorecorder/mythsetup-sep-2006.html" rel="nofollow noreferrer">MythTV</a> and <a href="http://www.cpan.org/modules/by-module/Mail/grepmail-4.51.readme" rel="nofollow noreferrer">grepmail</a>.</p>

[{'answer_id': 76698, 'author': 'Darren Meyer', 'author_id': 7826, 'author_profile': 'https://Stackoverflow.com/users/7826', 'pm_score': 2, 'selected': False, 'text': "<p>It's almost certain that your host doesn't have a definition for the timezone you're specifying, which is what's causing a value to be undefined.</p>\n\n<p>Have you checked to make sure a TZ definition file of the same name actually exists on the host?</p>\n"}, {'answer_id': 76821, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>Date::Manip is supposed to be self-contained. It has a list of all its time zones in its own source, following "$zonesrfc=".</p>\n'}, {'answer_id': 82146, 'author': 'Sam Kington', 'author_id': 6832, 'author_profile': 'https://Stackoverflow.com/users/6832', 'pm_score': -1, 'selected': False, 'text': '<p>Can you try single-stepping through the debugger to see what exactly is going wrong? It could easily be %Zone that is wrong - %tz may be set correctly on line 1 or 2, but then the lookup on line 3 fails, ending up with undef.</p>\n\n<p>Edit: %Date::Manip::Cnf and %Date::Manip::Zone are global variables, so you should be able to take a dump of them before and after the call to Date::Manip::Date_Init. If I read the source correctly %Cnf should contain a basic skeleton of configuration options before the call to Date_Init, and %Zone should be empty; after Date_Init, TZ should have your chosen value, and %Zone should be populated by a lookup table of time zones.</p>\n\n<p>I see a reference to .DateManip.cnf in %Cnf, which might be something to look at - is it possible that you have such a file in your home directory, or the current working directory, which is overriding the default settings?</p>\n'}, {'answer_id': 167314, 'author': 'schwerwolf', 'author_id': 7045, 'author_profile': 'https://Stackoverflow.com/users/7045', 'pm_score': 2, 'selected': False, 'text': '<p>It is a <a href="http://rt.cpan.org/Public/Bug/Display.html?id=29655" rel="nofollow noreferrer">bug</a> in Date::Manip version 5.48-5.54 for Win32. I\'ve had difficulty with using standard/daylight variants of a timezones, e.g. \'EST5EDT\', \'US/Eastern\'. The only timezones that appear to work are those without daylight savings, e.g. \'EST\'.</p>\n\n<p>It is possible to turn off timezone conversion processing in the Date::Manip module:</p>\n\n<pre><code>Date::Manip::Date_Init("ConvTZ=IGNORE");\n</code></pre>\n\n<p><strong>This will have undesired side-effects if you treat dates correctly</strong>. I would not use this workaround unless you are confident you will be never be processing dates from different timezones.</p>\n'}]
['https://Stackoverflow.com/questions/76650', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']