in reply to (Ovid - try eval)Re: Only
in thread Only
But the function time() from Time::HiRes will not
be imported. To make this binding between &main::time
and &Time::HiRes::time we have to this at compile time:
Without the BEGIN, the binding of time to the correct function would not happen:BEGIN { eval { require Time::HiRes; import Time::HiRes qw(time) }; if($@) { warn "Unable to import Time::HiRes\n" }; }
Would produce f.exs: 976556706. Whileeval { require Time::HiRes; import Time::HiRes qw(time) }; print time()
Would produce the correct time using the Time::HiRes::time function: 976556789.394509.BEGIN { eval { require Time::HiRes; import Time::HiRes qw(time) }; } print time()
Autark.
|
---|
In Section
Seekers of Perl Wisdom