#!./perl
BEGIN {
chdir 't' if -d 't';
}
print "1..19\n";
# First we must set up some selfloader files
use SelfLoader;
sub foo;
sub bar;
sub bazmarkhianish;
sub a;
sub never; # declared but definition should never be read
1;
use SelfLoader;
sub a;
1;
sub a { 'a Bar'; }
sub b { 'b Bar' }
};
sub a { 'a Baz' }
sub b { 'b Baz' }
sub c { 'c Baz' }
use Foo;
use Bar;
print "ok 1\n";
print "ok 2\n";
# Try an undefined method
eval {
};
print "ok 3\n";
} else {
print "not ok 3 $@\n";
}
# Used to be trouble with this
eval {
};
print "ok 4\n";
} else {
print "not ok 4 $@\n";
}
# Pass regular expression variable to autoloaded function. This used
# to go wrong in AutoLoader because it used regular expressions to generate
# autoloaded filename.
"foo" =~ /(\w+)/;
print "ok 5\n";
print "ok 6\n";
print "ok 7\n";
print "ok 8\n";
print "ok 9\n";
# Check nested packages inside __DATA__
print "ok 10\n";
# Now check inheritance:
# Before anything is SelfLoaded there is no declaration of Foo::b so we should
# get Baz::b
print "ok 11\n";
# There is no Bar::c so we should get Baz::c
print "ok 12\n";
# This selfloads Bar::a because it is stubbed. It also stubs Bar::b as a side
# effect
print "ok 13\n";
print "ok 14\n";
print "ok 15\n";
# Check that __END__ is honoured
# Try an subroutine that should never be noticed by selfloader
eval {
};
print "ok 16\n";
} else {
print "not ok 16 $@\n";
}
# Try to read from the data file handle
} else {
print "ok 17\n";
}
# Check that __END__ DATA is honoured
# Try an subroutine that should never be noticed by selfloader
eval {
};
print "ok 18\n";
} else {
print "not ok 18 $@\n";
}
# Try to read from the data file handle
} else {
print "ok 19\n";
}
# cleanup
END {
}