diff options
Diffstat (limited to 'lib/autouse.pm')
-rw-r--r-- | lib/autouse.pm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/autouse.pm b/lib/autouse.pm index a15d08abc5..ab95a19d8a 100644 --- a/lib/autouse.pm +++ b/lib/autouse.pm @@ -49,9 +49,9 @@ sub import { } my $load_sub = sub { - unless ($INC{pm}) { - require $pm; - die $@ if $@; + unless ($INC{$pm}) { + eval {require $pm}; + die if $@; vet_import $module; } *$closure_import_func = \&{"${module}::$closure_func"}; @@ -73,7 +73,7 @@ sub vet_import ($) { my $module = shift; if (my $import = $module->can('import')) { croak "autoused module has unique import() method" - unless defined(\&Exporter::import) + unless defined(&Exporter::import) && $import == \&Exporter::import; } } |