sfink has asked for the wisdom of the Perl Monks concerning the following question:
This works:
But I have to use gettime() instead of time, and I have to use the parentheses. Using a noarg prototype doesn't help. I have tried various combinations of*gettime = do { eval "use Time::HiRes"; $@ } ? sub { time } : sub { Ti +me::HiRes::time() }; print gettime() . "\n";
Is there some way to change the behavior but not the usage of the time() built-in iff the module exists?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: overriding time() if module exists
by sgifford (Prior) on Nov 08, 2003 at 04:45 UTC | |
by sfink (Deacon) on Nov 08, 2003 at 19:56 UTC | |
by ysth (Canon) on Nov 09, 2003 at 03:57 UTC | |
|
Re: overriding time() if module exists
by Anonymous Monk on Nov 08, 2003 at 04:33 UTC |