spacey has asked for the wisdom of the Perl Monks concerning the following question:
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";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Time::Piece errors?
by sauoq (Abbot) on May 01, 2003 at 09:49 UTC | |
by atnonis (Monk) on May 01, 2003 at 10:00 UTC | |
|
Re: Time::Piece errors?
by spacey (Scribe) on May 01, 2003 at 10:11 UTC | |
by benn (Vicar) on May 01, 2003 at 10:47 UTC | |
by spacey (Scribe) on May 01, 2003 at 10:17 UTC | |
|
More Help please ? Time::Piece errors?
by spacey (Scribe) on May 01, 2003 at 10:42 UTC | |
by sauoq (Abbot) on May 01, 2003 at 10:58 UTC | |
by spacey (Scribe) on May 01, 2003 at 11:39 UTC |