On Thursday 08 July 2004 14:20, perl.org wrote:
>
> I have not been able to reproduce this in my drastically simplified
> test case; it must be a bug in my code (while I've written my share
> of bugs I honestly don't see how this could be one), a side effect of
> more complex interaction or some other issue.
>
> [snip]
>
> sub getDateTime
> {
> ( $data{sec}, $data{min}, $data{hour}, $data{day}, $data{mon},
> $data{year}, $data{wday}, $data{yday}, $data{isdst} ) = localtime(
> $^T ); $data{year} += 1900;
> $data{mon}++;
> return( %{data} );
> }
Perhaps you should keep the localtime data local to the sub (sort of
like a closure.)
{ my %data;
sub getDateTime {
unless ( %data ) {
@data{ qw[sec min hour day mon year wday yday isdst] } = localtime $^T;
$data{ year } += 1900;
$data{ mon }++;
}
return %data;
}
}
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>