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

Im trying to get the difference of two dates, and have used the following code:

my $days = Delta_Days($syyyy, $smm, $sdd, $eyyyy, $emm, $edd);

When I step into this line it calls the FETCH method of the lite.pm module, and terminates (crashes) on the line:

$self->Fetch($key, !$Win32::OLE::Strict);

I have the use Date::Calc qw(Delta_Days); line at the top of the module that is calling the Delta_Days method. Is there something else that I should do? Does the calc.pm file have to exists in a certain place?

Thanks in advance.

Replies are listed 'Best First'.
Re: use Date::Calc qw(Delta_Days)
by ysth (Canon) on Jul 23, 2004 at 16:44 UTC
    Grasping at straws...

    Do you have a package statement between the use Date::Calc and the call to Delta_Days?

    Do you have warnings enabled?

    Does this happen only in the debugger?

    Did you manually move Calc.pm, instead of using Makefile.PL or ppm to install it correctly?

    Does changing it to call Date::Calc::Delta_Days help?

    What does this show (just before the Delta_Days call):

    use Data::Dumper; print STDOUT Dumper($syyyy,$smm,$sdd,$eyyyy,$emm,$edd);
Re: use Date::Calc qw(Delta_Days)
by gellyfish (Monsignor) on Jul 23, 2004 at 12:40 UTC

    Precisely what error is it that you are getting?

    /J\

      No error. It just terminates.

        Just a long shot, but try this:

        eval { $self->Fetch($key, !$Win32::OLE::Strict); }; print $@;
        By wrapping the expression in eval, any die's that might have been issued will be trapped and you can inspect the reason why in $@.

        jeffa

        L-LL-L--L-LL-L--L-LL-L--
        -R--R-RR-R--R-RR-R--R-RR
        B--B--B--B--B--B--B--B--
        H---H---H---H---H---H---
        (the triplet paradiddle with high-hat)
        

        than perhaps some of the surrounding code might be useful, as it is not clear at all what you are trying to do

        /J\