On Thursday 12 April 2007 20:54, Eric Wilhelm spake thus:
> The only part keeping me from doing it is that I can't find stopped
> clock.

You mean you would like localtime() and Co to return the same date+time 
throughout a test run?

Can't we override the relevant functions just like you were suggesting we do 
with system()?

Something like this "proof of concept"?

<code>
#!/usr/bin/perl

use strict;
use warnings;

use ex::override localtime => sub {
  my $sec = 59;
  my $min = 59;
  my $hour = 23;
  my $mday = 24;
  my $mon = 12;
  my $year = 107;
  my $wday = 1;
  my $yday = 358;
  my $isdst = 0;

  return ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst);
};

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;

print "$hour:$min:$sec\n";
</code>

Cheers,
Eric
-- 
Eric Mountain
_______________________________________________
Dirvish mailing list
[EMAIL PROTECTED]
http://www.dirvish.org/mailman/listinfo/dirvish

Reply via email to