summaryrefslogtreecommitdiff
path: root/lib/SelfLoader.pm
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2001-04-27 01:13:52 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2001-04-26 22:34:31 +0000
commit33235a50d090f47e8c1345f546ef4a97abb985d9 (patch)
treeaba122aa0a0698913ad7f0c46ae2a83a6a291146 /lib/SelfLoader.pm
parenta5b0cd91efde01b3e03f141462c306e7c683693a (diff)
downloadperl-33235a50d090f47e8c1345f546ef4a97abb985d9.tar.gz
more for Devel::SelfStubber
Message-ID: <20010427001351.K88186@plum.flirble.org> p4raw-id: //depot/perl@9872
Diffstat (limited to 'lib/SelfLoader.pm')
-rw-r--r--lib/SelfLoader.pm14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/SelfLoader.pm b/lib/SelfLoader.pm
index 3b9c52d912..51124af6b4 100644
--- a/lib/SelfLoader.pm
+++ b/lib/SelfLoader.pm
@@ -47,7 +47,8 @@ AUTOLOAD {
sub load_stubs { shift->_load_stubs((caller)[0]) }
sub _load_stubs {
- my($self, $callpack) = @_;
+ # $endlines is used by Devel::SelfStubber to capture lines after __END__
+ my($self, $callpack, $endlines) = @_;
my $fh = \*{"${callpack}::DATA"};
my $currpack = $callpack;
my($line,$name,@lines, @stubs, $protoype);
@@ -94,7 +95,16 @@ sub _load_stubs {
push(@lines,$line);
}
}
- close($fh) unless defined($line) && $line =~ /^__END__\s*DATA/; # __END__
+ if (defined($line) && $line =~ /^__END__/) { # __END__
+ unless ($line =~ /^__END__\s*DATA/) {
+ if ($endlines) {
+ # Devel::SelfStubber would like us to capture the lines after
+ # __END__ so it can write out the entire file
+ @$endlines = <$fh>;
+ }
+ close($fh);
+ }
+ }
push(@stubs, $self->_add_to_cache($name, $currpack, \@lines, $protoype));
eval join('', @stubs) if @stubs;
}