Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Date::Calc

Status
Not open for further replies.
Feb 16, 2003
87
GB
Hello,

An odd one I can't get round:

The first bit works but when I try to get Date::Calc to work with a date other than todays - it gives up!

use Date::Calc::Object qw:)all);

#THIS WORKS - using today():

if ($FORM{'Renew'} eq "month") {$newrenewdate = Date::Calc->today(), $newrenewdate += [0,1,0] };
if ($FORM{'Renew'} eq "quarter") {$newrenewdate = Date::Calc->today(), $newrenewdate += [0,3,0] };
if ($FORM{'Renew'} eq "year") {$newrenewdate = Date::Calc->today(), $newrenewdate += [1,0,0] };



#THIS DOESN'T! - using a variable:

$renewfromdate eq "$FORM{'OrderDate'}";

if ($FORM{'Renew'} eq "month") {$newrenewdate = Date::Calc->$renewfromdate, $newrenewdate += [0,1,0] };
if ($FORM{'Renew'} eq "quarter") {$newrenewdate = Date::Calc->$renewfromdate, $newrenewdate += [0,3,0] };
if ($FORM{'Renew'} eq "year") {$newrenewdate = Date::Calc->$renewfromdate, $newrenewdate += [1,0,0] };
 
Simon,

Check your assignment method

$renewfromdate = "$FORM{'OrderDate'} not eq

HTH
Paul
 
Thank Paul - very bizzare this though:

Can't locate auto/Date/Calc/2003-04-12.al in @INC etc . . .
 
Right after it's called - not stopping the script running - but displaying an error.

Simon
 
I'm still nowhere closer with this one - any Date::Calc experts out there?!

Simon
 
Simon,

From your post
Can't locate auto/Date/Calc/2003-04-12.al in @INC etc
it would look like somehow you're calling the date as a procedure in Date::Calc

Can you post some code?

Paul
 
Sorry - this is what I've been using:

use Date::Calc qw:)all);

my $newrenewdate;
$renewfromdate = $FORM{'OrderDate'};


if ($FORM{'Renew'} eq "month") {$newrenewdate = Date::Calc->$renewfromdate, $newrenewdate += [0,1,0] };
if ($FORM{'Renew'} eq "quarter") {$newrenewdate = Date::Calc->$renewfromdate, $newrenewdate += [0,3,0] };
if ($FORM{'Renew'} eq "year") {$newrenewdate = Date::Calc->$renewfromdate, $newrenewdate += [1,0,0] };
 
Yup,

with the code you posted I'm getting the same error.
Tried google for the error string, and the only thing that came up is what we're getting on TT.

I haven't read the dox for Date::Calc, and won't have time to before Sunday/monday

Advise you check out the documentation - I wouldn't think that a released module would only have one reported error

Sorry 'bout that
Paul

Ps I even installed Date::Calc, same error as yourself - looking for the date in a submodule

What format is 'OrderDate' expected in ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top