oldcity has asked for the wisdom of the Perl Monks concerning the following question:

<p.Linux Mint 21.2 fully up to date. This routine has been in use for several years. the program runs just fine on an old not up to date machine. It does not work after install the 2 updates. 1 had word wayans in it. 4 days ago on my work machine. I don't know how to get around it. {

# next line here would be 2731 use Date::Format; use Date::Calc qw(Add_Delta_Days); $date = sprintf(time2str("%D", time)); Below error message produced on section call up Date::Calc::Delta_Days(): not a valid date at GasProg line 2731.
tia oldcity

Replies are listed 'Best First'.
Re: Routine stopped working
by talexb (Chancellor) on Jan 18, 2024 at 15:54 UTC
      Below error message produced on section call up Date::Calc::Delta_Days(): not a valid date at GasProg line 2731.

    Should Delta_Days be Add_Delta_Days? That's just a guess, because you haven't included a self-contained example for us to try out.

    Alex / talexb / Toronto

    Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Re: Routine stopped working
by GrandFather (Saint) on Jan 18, 2024 at 20:15 UTC

    Reduce your code to just half a dozen lines that show the problem when run, then show us that.

    Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
Re: Routine stopped working
by LanX (Saint) on Jan 18, 2024 at 16:37 UTC
    Just guessing

    You should try to figure out the difference between your old and new environment.

    Are all dependencies installed and is time really returning the current date?

    Try entering debug warn to isolate the problem.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

Re: Routine stopped working
by Marshall (Canon) on Jan 19, 2024 at 13:30 UTC
    time2str() is in Date::Format and it doesn't need Date::Calc.

    I don't see how an error can happen on Date::Calc because it is not used.

    use strict; use warnings; use Date::Format; #use Date::Calc qw(Add_Delta_Days); ##not needed my $date = sprintf(time2str("%D", time)); print $date; # 01/19/24
    Update: check your line numbering

      Found that this was the culprit. Fixed problem much research.

      $date = sprintf(time2str("%D", time));
Re: Routine stopped working - Date::Format and Date::Calc
by Discipulus (Canon) on Jan 19, 2024 at 12:38 UTC
    Hello oldcity,

    what did you upgraded?

    # win perl -MDate::Format -MDate::Calc="Add_Delta_Days" -we "printf(time2str +('%D', time))" 01/19/24 perl -MDate::Format -MDate::Calc -wE "say 'Date::Format ',$Date::Forma +t::VERSION; say 'Date::Calc ',$Date::Calc::VERSION" Date::Format 2.24 Date::Calc 6.4

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.