diff options
author | Steffen Müller <0mgwtfbbq@sneakemail.com> | 2007-01-10 19:52:23 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-01-11 09:51:56 +0000 |
commit | 3256a4f81269a0cb31d9dd71cd296e224c40dc32 (patch) | |
tree | 43fd49515ad6a19e1ec09a540d36c8ed482fdd76 | |
parent | 5fa550fb3553a576bba2951a8073ed615edabf77 (diff) | |
download | perl-3256a4f81269a0cb31d9dd71cd296e224c40dc32.tar.gz |
AutoLoader fix, part 2
Message-ID: <20070110175148.26694.qmail@lists.develooper.com>
p4raw-id: //depot/perl@29750
-rw-r--r-- | lib/AutoLoader.pm | 2 | ||||
-rwxr-xr-x | lib/AutoLoader.t | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/AutoLoader.pm b/lib/AutoLoader.pm index 25b392848a..e33a4bee94 100644 --- a/lib/AutoLoader.pm +++ b/lib/AutoLoader.pm @@ -102,7 +102,7 @@ sub find_filename { # (and failing) to find the 'lib/auto/foo/bar.al' because it # looked for 'lib/lib/auto/foo/bar.al', given @INC = ('lib'). - if (-r $filename) { + if (defined $filename and -r $filename) { unless ($filename =~ m|^/|s) { if ($is_dosish) { unless ($filename =~ m{^([a-z]:)?[\\/]}is) { diff --git a/lib/AutoLoader.t b/lib/AutoLoader.t index da7071b32b..92d66fa731 100755 --- a/lib/AutoLoader.t +++ b/lib/AutoLoader.t @@ -16,7 +16,7 @@ BEGIN unshift @INC, $dir; } -use Test::More tests => 21; +use Test::More tests => 22; # First we must set up some autoloader files my $fulldir = File::Spec->catdir( $dir, 'auto', 'Foo' ); @@ -164,8 +164,21 @@ AutoLoader->unimport(); ::is( Baz->AUTOLOAD(), 'i am here', '... but not non-imported AUTOLOAD()' ); + +package SomeClass; +use AutoLoader 'AUTOLOAD'; +sub new { + bless {} => shift; +} + package main; +$INC{"SomeClass.pm"} = $0; # Prepare possible recursion +{ + my $p = SomeClass->new(); +} # <-- deep recursion in AUTOLOAD looking for SomeClass::DESTROY? +::ok(1, "AutoLoader shouldn't loop forever if \%INC is modified"); + # cleanup END { return unless $dir && -d $dir; |