overriding core functions

I spent some time today trying to override perl's time() function for some tests. after a few iterations in solitary that didn't quite cut it, I stumbled upon this list discussion. and so, after far too much independent work, 5 minutes of google yielded

BEGIN { *CORE::GLOBAL::time = sub { CORE::time };}

{ no warnings qw(redefine);

local *CORE::GLOBAL::time = sub { $time };}

while I got the BEGIN part on my own, the trick I was missing in my own hacking was to reassign CORE::GLOBAL::time() to itself so that it would continue to function until my local overrides went into effect.

I imagine that most test-driven people already know this, but just in case I wasn't the only person sleeping in class I thought I'd post it here.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Without JavaScript enabled, you might want to
use the classic discussion system instead. If you login, you can remember this preference.