Skip to content

Commit 5ea8c7e

Browse files
committed
Time::HiRes: avoid importing via export_to_level
The export_to_level function forces Exporter to always load Exporter::Heavy. This can be avoided by only using Exporter::import. Time::HiRes's import is only trying to prevent exports of unimplemented functions and doesn't need to make any modifications to its arguments. This means doing a goto &Exporter::import will do everything needed.
1 parent de36a92 commit 5ea8c7e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

dist/Time-HiRes/HiRes.pm

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ sub AUTOLOAD {
7474
}
7575

7676
sub import {
77-
my $this = shift;
78-
for my $i (@_) {
77+
for my $i (@_[1 .. $#_]) {
7978
if (($i eq 'clock_getres' && !&d_clock_getres) ||
8079
($i eq 'clock_gettime' && !&d_clock_gettime) ||
8180
($i eq 'clock_nanosleep' && !&d_clock_nanosleep) ||
@@ -88,7 +87,7 @@ sub import {
8887
Carp::croak("Time::HiRes::$i(): unimplemented in this platform");
8988
}
9089
}
91-
Time::HiRes->export_to_level(1, $this, @_);
90+
goto &Exporter::import;
9291
}
9392

9493
XSLoader::load( 'Time::HiRes', $XS_VERSION );

0 commit comments

Comments
 (0)