Skip to content

Commit 68944d4

Browse files
committed
Benchmark: don't import Time::HiRes::time; we don't use it
Also: - use block eval, not string eval - BEGIN, not sub BEGIN
1 parent 4f3cdae commit 68944d4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/Benchmark.pm

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ our(@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $VERSION);
482482
clearcache clearallcache disablecache enablecache);
483483
%EXPORT_TAGS=( all => [ @EXPORT, @EXPORT_OK ] ) ;
484484

485-
$VERSION = 1.26;
485+
$VERSION = 1.27;
486486

487487
# --- ':hireswallclock' special handling
488488

@@ -492,9 +492,8 @@ sub mytime () { time }
492492

493493
init();
494494

495-
sub BEGIN {
496-
if (eval 'require Time::HiRes') {
497-
Time::HiRes->import('time');
495+
BEGIN {
496+
if (eval { require Time::HiRes }) {
498497
$hirestime = \&Time::HiRes::time;
499498
}
500499
}

0 commit comments

Comments
 (0)