use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(AUTOLOAD);
-our $VERSION = "1.11";
+our $VERSION = "1.12";
sub Version {$VERSION}
sub DEBUG () { 0 }
local($/) = "\n";
while(defined($line = <$fh>) and $line !~ m/^__END__/) {
- if ($line =~ m/^sub\s+([\w:]+)\s*((?:\([\\\$\@\%\&\*\;]*\))?(?:$attr_list)?)/) {
+ if ($line =~ m/^\s*sub\s+([\w:]+)\s*((?:\([\\\$\@\%\&\*\;]*\))?(?:$attr_list)?)/) {
push(@stubs, $self->_add_to_cache($name, $currpack, \@lines, $protoype));
$protoype = $2;
@lines = ($line);
@INC = $dir;
push @INC, '../lib';
- print "1..19\n";
+ print "1..20\n";
# First we must set up some selfloader files
mkdir $dir, 0755 or die "Can't mkdir $dir: $!";
package sheep;
sub bleat { shift; shift || "baa" }
-
__END__
sub never { die "D'oh" }
EOT
sub new { bless {}, shift }
sub a;
+sub with_whitespace_in_front;
1;
__DATA__
sub a { 'a Bar'; }
sub b { 'b Bar' }
+ sub with_whitespace_in_front {
+ "with_whitespace_in_front Bar"
+}
+
__END__ DATA
sub never { die "D'oh" }
EOT
print "not " unless $bar->c() eq 'c Baz';
print "ok 12\n";
+# check that subs with whitespace in front work
+print "not " unless $bar->with_whitespace_in_front() eq 'with_whitespace_in_front Bar';
+print "ok 13\n";
+
# This selfloads Bar::a because it is stubbed. It also stubs Bar::b as a side
# effect
print "not " unless $bar->a() eq 'a Bar';
-print "ok 13\n";
+print "ok 14\n";
print "not " unless $bar->b() eq 'b Bar';
-print "ok 14\n";
+print "ok 15\n";
print "not " unless $bar->c() eq 'c Baz';
-print "ok 15\n";
+print "ok 16\n";
$foo->never;
};
if ($@ =~ /^Undefined subroutine/) {
- print "ok 16\n";
+ print "ok 17\n";
} else {
- print "not ok 16 $@\n";
+ print "not ok 17 $@\n";
}
# Try to read from the data file handle
my $foodata = <Foo::DATA>;
close Foo::DATA;
if (defined $foodata) {
- print "not ok 17 # $foodata\n";
+ print "not ok 18 # $foodata\n";
} else {
- print "ok 17\n";
+ print "ok 18\n";
}
# Check that __END__ DATA is honoured
$bar->never;
};
if ($@ =~ /^Undefined subroutine/) {
- print "ok 18\n";
+ print "ok 19\n";
} else {
- print "not ok 18 $@\n";
+ print "not ok 19 $@\n";
}
# Try to read from the data file handle
my $bardata = <Bar::DATA>;
close Bar::DATA;
if ($bardata ne "sub never { die \"D'oh\" }\n") {
- print "not ok 19 # $bardata\n";
+ print "not ok 20 # $bardata\n";
} else {
- print "ok 19\n";
+ print "ok 20\n";
}
# cleanup