When using the below code its fine until i try and find the time difference between the minutes.
I’m running this on activestate perl. which gives the error of
Can't locate object method "min" via package "Time::Seconds" (perhaps
to load "Time::Seconds"?) at
C:\Inetpub\GMN542\timetest.pl line 19.
Normally if i had this error on Unix i guess the perl module
was not installed but i have looked on my windows box and I found that I do have
C:\Perl\site\lib\Time\Piece.pm
and
C:\Perl\site\lib\Time\Seconds.pm
So is this just an error with the way im trying to query the
minute strings?
I guess the question is have I got a problem with my installation of the perl modules?
Or
Is it due to the wrong variable name used for minute? I think I have tried “minute” and “min”.
Again as ever any help that anybody can offer is more then appreciated
regards
Gareth
#!/usr/bin/perl use Time::Piece; use Time::Seconds; $before = Time::Piece->strptime("2003/04/30 10:00:00", "%Y/%m/%d %H:%M +:%S"); $now = localtime(time); $diff = $now - $before; $years = int($diff->years); $diff -= $years * ONE_YEAR; $months = int($diff->months); $diff -= $months * ONE_MONTH; $days = int($diff->days); $diff -= $hours * ONE_HOUR; $hours = int($diff->hours); $diff -= $min * ONE_MIN; $min = int($diff->min); print "$years years, $months months, $days days since , $hours hours s +ince, $min min since $before\n";
In reply to Time::Piece errors? by spacey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |