sub vet_import ($) {
my $module = shift;
if (my $import = $module->can('import')) {
- croak "autoused module has unique import() method"
+ croak "autoused module $module has unique import() method"
unless defined(&Exporter::import)
- && $import == \&Exporter::import;
+ && ($import == \&Exporter::import ||
+ $import == \&UNIVERSAL::import)
}
}
}
use Test;
-BEGIN { plan tests => 10; }
+BEGIN { plan tests => 12; }
BEGIN {
require autouse;
ok( soundex('Basset'), 'B230' );
ok( exists $INC{$mod_file} );
+use autouse Env => "something";
+eval { something() };
+ok( $@, qr/^\Qautoused module Env has unique import() method/ );
+
+# Check that UNIVERSAL.pm doesn't interfere with modules that don't use
+# Exporter and have no import() of their own.
+require UNIVERSAL;
+autouse->import("Class::ISA" => 'self_and_super_versions');
+my %versions = self_and_super_versions("Class::ISA");
+ok( $versions{"Class::ISA"}, $Class::ISA::VERSION );