in reply to Simulating the Future

Given your constraint (changing the system clock is not an option), I'd set myself up with a subroutine that I called every-time I needed to refer to the clock. A little bit of Getopts::Std to let me pass a parameter in from the command line, and I can set the subroutine to return anytime I like.

----
I Go Back to Sleep, Now.

OGB

Replies are listed 'Best First'.
Re^2: Simulating the Future
by dynamo (Chaplain) on Jan 04, 2008 at 19:53 UTC
    Well, that's sorta like what I was thinking.. The problem is that I can't make something like mytime() and replace throughout the code because A> waaaay too many to replace, and B> it's an internal codebase change. The testing system has to fake the time externally to validate the code, otherwise it would be modified again when I take out the test..

    My first thought was to try using something like this:

    package FakeTime; sub main::time { 12345 } 1;
    That didn't work. Neither did "sub ::time { 12345 }", I thought that might work as a second resort. Didn't.

    - d