Re: year not returned by Time::localtime
- From: "DJ Stunks" <DJStunks@xxxxxxxxx>
- Date: 28 May 2006 16:13:57 -0700
SteveP wrote:
Here is a snippet of code that illustrates my problem (or is it a bug?)
#!c:\perl\bin\perl
use Time::localtime; # overrides CORE::localtime
use Time::Local;
$nowYear = localtime->year();
$date = timelocal(0,0,0,1,3,$nowYear);
($sec,$min,$hr,$mday,$mon,$year,$wday,$yday,$isdst) =
CORE::localtime($date);
($sec,$min,$hr,$mday,$mon,$badyear,$wday,$yday,$isdst) =
localtime($date);
why did you think you could call Time::localtime::localtime like this?
From the documentation for Time::localtime:
This module's default exports override the core localtime()
function, replacing it with a version that returns ``Time::tm''
objects.
I think that if you check you'll find that all your variables except
$sec are undef (including $badyear) and $sec is actually a Time::tm
object....
$funYear = localtime($date)->year();
print "year [", $year, "] badyear [", $badyear, "] funYear = [",
$funYear, "]\n";
CORE localtime works as expected but the function oriented interface
doesn't return anything for year in an array return value. Shouldn't it
return the same thing as the explicit function?
why doyou think it has an "array return value" by which I suppose you
mean "list context"...
-jp
.
- Follow-Ups:
- Re: year not returned by Time::localtime
- From: SteveP
- Re: year not returned by Time::localtime
- References:
- year not returned by Time::localtime
- From: SteveP
- year not returned by Time::localtime
- Prev by Date: Re: regex extraction problem
- Next by Date: Re: regex extraction problem
- Previous by thread: year not returned by Time::localtime
- Next by thread: Re: year not returned by Time::localtime
- Index(es):
Relevant Pages
|
|