# (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) {
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' );
::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;