Ah, perfect!
Here's what I really want, though:
UPDATE (Fri Apr 30 11:15:23 PDT 2004):#!/usr/bin/perl -w use strict; BEGIN { Time::HiRes->import('time') if eval "require Time::HiRes"; } my $time = time; print "$time\n";
Your advice is well-received, chip! Changed the eval EXPR to eval BLOCK. As for letting the user know, that is also a good idea. I left that out for brevity. This is actually for a patch to Net::IRC, so I'll let Jeremy (the maintainer) decide weather he wants to emit a warning.
#!/usr/bin/perl -w use strict; BEGIN { Time::HiRes->import('time') if eval { require Time::HiRes }; } my $time = time; print "$time\n";
In reply to Re: Re: Conditionally override 'time' builtin with Time::HiRes::time()
by meonkeys
in thread Conditionally override 'time' builtin with Time::HiRes::time()
by meonkeys
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |