in reply to Re: Overcoming 5.10.0 vs 5.38.2 incompatibilities
in thread Overcoming 5.10.0 vs 5.38.2 incompatibilities

Firstly, thank you for pointing me to the delta documentation. The target module purpose is to calculate date/time differences
#1 how does the difference manifest itself Original in 5.10.0 (I added the line that says "comparing..." 1..60 ok 1 - use xxx::DateDelta; # # comapring 4.000000 to 4.000000 at 0 func=seconds prec= type= field=s +econds ok 2 - seconds() (with time) # comapring 4 to 4 at 1 func=seconds prec=trunc type= field=seconds ok 3 - seconds(trunc) (with time) # comapring 34298704.000000 to 34298704.000000 at 2 func=total_seconds + prec= type=total_ field=seconds ... 1..60 ok 1 - use AMG::DateDelta; # # comapring 4.000000 to 4.000000 at 0 func=seconds prec= type= field=s +econds ok 2 - seconds() (with time) # comapring 4 to 4 at 1 func=seconds prec=trunc type= field=seconds ok 3 - seconds(trunc) (with time) # comapring 34298704.000000 to 34298704.000000 at 2 func=total_seconds + prec= type=total_ field=seconds ok 4 - total_seconds() (with time) # comapring 34298704 to 34298704 at 3 func=total_seconds prec=trunc ty +pe=total_ field=seconds ok 5 - total_seconds(trunc) (with time) # comapring 25.066667 to 25.066667 at 4 func=minutes prec= type= field +=minutes
But when I run on 538.2 I get
t/test.t .. 1/60 # # comapring 4.000000 to 4.000000 at 0 func=seconds prec= type= field=s +econds # comapring 4 to 4 at 1 func=seconds prec=trunc type= field=seconds ... # comapring 571645.066667 to 571645.066667 at 6 func=total_minutes pre +c= type=total_ field=minutes # comapring 571645.000000 to 571645 at 7 func=total_minutes prec=trunc + type=total_ field=minutes # comapring 9527.417778 to 23.417778 at 8 func=hours prec= type= field +=hours # Failed test 'hours() (with time)' # at t/test.t line 97. # Expected 23 got 9527.417778 # comapring 9527 to 23 at 9 func=hours prec=trunc type= field=hours # Failed test 'hours(trunc) (with time)' # at t/test.t line 97. # Expected 9527.417778 got 9527 # comapring 9527.417778 to 9527.417778 at 10 func=total_hours prec= ty +pe=total_ field=hours /\/\/\/
creating the class:
use Class::MethodMaker new_with_init => 'new', get_set => [ qw ( _delta_date _delta_time )], boolean => [ qw ( _use_time_flag ) ]
and the function for hours looks like:
sub hours { my $self = shift; my $name = (caller(0))[3]; return $self->_format_time((defined($_[0]) && $_[0] eq 'trunc') ? '%hv' : '%hd') }

Replies are listed 'Best First'.
Re^3: Overcoming 5.10.0 vs 5.38.2 incompatibilities
by ikegami (Patriarch) on Mar 12, 2024 at 04:12 UTC

    Are you really saying you didn't get ok 1 - use xxx::DateDelta; and ok 2 - seconds() (with time)? Also, you forgot to provide the code.

Re^3: Overcoming 5.10.0 vs 5.38.2 incompatibilities
by eyepopslikeamosquito (Archbishop) on Mar 12, 2024 at 07:07 UTC

    To help us help you, please put in the effort to create at least one SSCCE that we can run ... or explain clearly why you're unable/unwilling to do that.

    👁️🍾👍🦟