I want to test for the existence of a module, and do alternative
calculations based on the result. So I have written the following, based
on http://www.unix.org.ua/orelly/perl/cookbook/ch12_03.htm
BEGIN {
$flag_hires=0;
unless (eval "use Time::HiRes qw(gettimeofday tv_interval)" ) {
$flag_hires=1;
$timefirst=$timelast = [gettimeofday];print "Hello2 ";
}else{$timefirst=$timelast=time();print "Hello3 ";}
}
This code ALWAYS returns flag_hires=1
even if I introduce an error, e.g., "use Time::HHiRes...."
Why? Also, it appears I can't use [gettimeofday] in the BEGIN block.
Thanks for your help as I delve into new areas.
--Nelson R. Pardee, Support Analyst, Information Technology & Services--
--Syracuse University, 211 Machinery Hall, Syracuse, NY 13244-1260 --
--(315) 443-1079 [EMAIL PROTECTED] --
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs