Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Time::HiRes

Quote Reply
Time::HiRes
I notice in the Links SQL code you use:

BEGIN { eval { require Time::HiRes; import Time::HiRes qw/time/; }; }

I've always used:

use Time::HiRes qw(time);

Is that wrong or is there a difference?
Quote Reply
Re: [PaulW] Time::HiRes In reply to
That way, it won't barf if you don't have Time::HiRes.


Adrian
Quote Reply
Re: [brewt] Time::HiRes In reply to
I was thinking more in terms of this bit:

import Time::HiRes qw/time/;

Is that because you need "require" for eval and you can't use qw(time) with require?

Last edited by:

PaulW: Nov 20, 2001, 2:05 PM
Quote Reply
Re: [PaulW] Time::HiRes In reply to
Yep.

From Perl in a Nutshell:
use Module list
use version
use Module version list

and

require filename
require num
require package


Adrian
Quote Reply
Re: [brewt] Time::HiRes In reply to
Yep I can grasp that, I just hadn't seen "import" at perldoc on the modules page

Im sure it is there somewhere....may go and take a look...
Quote Reply
Re: [PaulW] Time::HiRes In reply to
Hi,

use Foo 'bar';

is equivalant to:

BEGIN {
require Foo;
import Foo 'bar';
}

Without the import, you wouldn't have `time` overidden.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Time::HiRes In reply to
Thanks for clearing that up.

Thanks to brewt also.