in reply to Re^2: Copy a builtin sub to a different name and then override
in thread Copy a builtin sub to a different name and then override
> ...
> my $actual_sleep = \&CORE::GLOBAL::sleep;
This should solve it in a robust manner:
my $actual_sleep = exists &CORE::GLOBAL::sleep # already overridden + ? ? \&CORE::GLOBAL::sleep : \&CORE::sleep
Point is you are changing sleep globally, but some other modules might be trying to do the same thing already. (well ...)
If you install your override later, you'll be playing safe.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
even more robust with defined instead of exists , see Haarg's comment in this thread for details.
|
|---|