diff options
author | Michael G. Schwern <schwern@pobox.com> | 2003-11-01 14:57:45 -0800 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-11-03 21:55:42 +0000 |
commit | 03699e8e149475044b8cf43118cce81b4d360dfb (patch) | |
tree | f5047f98620814980d4b55d4dbe1ef80d3b11413 | |
parent | 2a5407e4bc6bda1411e5f9fc8e1b8a13425937d2 (diff) | |
download | perl-03699e8e149475044b8cf43118cce81b4d360dfb.tar.gz |
Re: [perl #24384] 21418 (UNIVERSAL.pm patch) breaks autouse.pm
Message-ID: <20031102065745.GN3659@localhost.comcast.net>
(goes with change #21418)
p4raw-link: @21418 on //depot/perl: 2bfd56816acd10b1f958d1dde1769bafd756cbea
p4raw-id: //depot/perl@21650
-rw-r--r-- | lib/autouse.pm | 5 | ||||
-rw-r--r-- | lib/autouse.t | 12 |
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/autouse.pm b/lib/autouse.pm index 68646a4720..a5efaaca7f 100644 --- a/lib/autouse.pm +++ b/lib/autouse.pm @@ -73,9 +73,10 @@ sub import { 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) } } diff --git a/lib/autouse.t b/lib/autouse.t index 0a2d68003f..bdd2fba883 100644 --- a/lib/autouse.t +++ b/lib/autouse.t @@ -6,7 +6,7 @@ BEGIN { } use Test; -BEGIN { plan tests => 10; } +BEGIN { plan tests => 12; } BEGIN { require autouse; @@ -55,3 +55,13 @@ ok( !exists $INC{$mod_file} ); 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 ); |