I am debugging an old version of Date::Manip (5.42) in an ancient version of Perl (5.8.3). Can anyone explain what's going on? This is the command being run (do not ask me why):
perl -d -l -MDate::Manip -e 'Date_Init("Internal=1"); print Date_NextW +orkDay(ParseDate("today"), ParseDate("today"))'

In a recent Perl, it loops for a long time, and eventually returns with

ERROR: Invalid year (10000)

This is the important part of the debugging session:

DB<2> l 3558: while ($off>0) { 3559: while (1) { 3560: $date=&DateCalc_DateDelta($date,"+0:0:0:1:0:0:0",\$err,0 +); 3561: last if (&Date_IsWorkDay($date,$time)); 3562 } 3563: $off--; 3564 } 3565 3566: return $date; 3567 } DB<2> c 3558 Date::Manip::Date_NextWorkDay(/home/legacy/perl/lib/site_perl/5.8.3/Da +te/Manip.pm:3558): 3558: while ($off>0) { DB<3> x $off 0 20131016053748 DB<4> print "Greater" if $off>0; Greater DB<5> s Date::Manip::Date_NextWorkDay(/home/legacy/perl/lib/site_perl/5.8.3/Da +te/Manip.pm:3566): 3566: return $date; DB<5> use Devel::Peek; print Dump $off; SV = PVMG(0x87f2fb0) at 0x84b42e8 REFCNT = 2 FLAGS = (PADBUSY,PADMY,NOK,POK,pIOK,pNOK,pPOK) UV = 4294967295 NV = 20131016053748 PV = 0x87f2eb8 "20131016053748"\0 CUR = 14 LEN = 15

The question is: does anyone remember a bug in Perl similar to this? It looks like $off was erroneously treated as negative in the underlying C, but I am not sure.

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

In reply to Loop Not Entered by choroba

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.