It puzzled me. This code worked on a different server, but failed on Perl v5.8.8 with Date :: Manip loaded from CPAN today.
Warning: Use of uninitialized value in numeric lt (<) at /home/downside/lib/Date/Manip.pm line 3327. at dailyupdate.pl line 13 main::__ANON__('Use of uninitialized value in numeric 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
Simple code:
sub getdate() { my $err; ## today &Date::Manip::Date_Init('TZ=EST5EDT'); my $today = Date::Manip::UnixDate('today','%Y-%m-%d'); ## today date ####print "Today is ",$today,"\n"; ## ***TEMP*** return($today); }
That is right; Date :: Manip does not work for "today" .
A string in Date :: Manip that does not work:
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<0); ### ERROR OCCURS HERE
So Date :: Manip assumes that $Cnf was initialized with "ConvTZ" or "TZ" elements. They are initialized in Date_Init , so you should take care of them.
This is just a failure in my big program. If I just extract the β getdate() β above and run it autonomously, there is no error. So something about the global environment that affects this.
This seems to be a well-known but incomprehensible problem. If you search Google for βUsing Uninitialized Date-Date Manipulation,β there are about 2,400 hits. This error has been reported with MythTV and grepmail .