Re: Use of uninitialized value in numeric lt (<) at /Date/Manip.pm



On Sep 17, 2:58 am, John Nagle <na...@xxxxxxxxxxx> wrote:
..
..
The line in Date::Manip that is failing is

   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

It's just a warning - not an error in itself. But if it's leading to
incorrect results, then there's probably something not right :-)


So Date::Manip is assuming that $Cnf has been initialized with elements "ConvTZ"
or "TZ".

I think $tz must be *initialized* by the time

$tz=$Zone{"n2o"}{lc($tz)} if ($tz !~ /^[+-]\d{4}$/);

gets run. If it were not initialized at that stage you'd get a warning
along the lines of "Use of uninitialized value $tz in pattern match
(m//) at Manip.pm line 3324. That being so, it must be the '$tz =
$Zone{"n2o"}{lc($tz)}' that's assigning undef to $tz - since there's
no other way that an initialized $tz could become uninitialized (that
I can think of, anyway).

Probably wouldn't hurt to hack in some print() statements just to see
what $tz contains at various stages - and also to check what
$Zone{"n2o"}{lc($tz)} contains. I don't know much about Date::Manip,
but my hunch is that it's the contents of $Zone{"n2o"}{lc($tz)} that's
causing the problem.

Cheers,
Rob

.



Relevant Pages

  • Re: Date Formulas
    ... Phillip Jones wrote: ... then Excel 2004 will throw a warning that the formula is incorrect and ask whether you want to correct it. ... Phillip M. Jones, CET |LIFE MEMBER: VPEA ETA-I, NESDA, ISCET, Sterling ...
    (microsoft.public.mac.office.excel)
  • Re: Typecasting in C
    ... > maybe a warning is needed, ... It's incorrect in C, regardless of the particular implementation; ... passing a pointer argument for a "%p" format calls for a cast to void* ... A warning about incorrect code is not clutter. ...
    (comp.lang.c)
  • Re: Problem with malloc
    ... >> value, the warning is suppressed. ... >> code is still incorrect and will break on some systems. ... malloc in order to cast its return value to something, ... It should definitely an unsigned int. ...
    (comp.lang.c)
  • Re: what does this warning mean ?
    ... This warning is bogus and incorrect. ... int mainis indeed an old-style function ...
    (comp.lang.c)
  • Re: Look what the crappy update does to the compiler
    ... Dunno if it's related, but did you also mention the incorrect ... the new Delphi compiler complains about a return value being ... is behind the incorrect warning, it can only be sign of a bad ...
    (borland.public.delphi.language.basm)