summaryrefslogtreecommitdiff
path: root/lib/Devel
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/Devel
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/Devel')
-rw-r--r--lib/Devel/SelfStubber.pm15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/Devel/SelfStubber.pm b/lib/Devel/SelfStubber.pm
index ba833ff70e..9009d69c9a 100644
--- a/lib/Devel/SelfStubber.pm
+++ b/lib/Devel/SelfStubber.pm
@@ -28,13 +28,13 @@ sub _package_defined {
sub stub {
my($self,$module,$lib) = @_;
- my($line,$end,$fh,$mod_file,$found_selfloader);
+ my($line,$end_data,$fh,$mod_file,$found_selfloader);
$lib ||= '.';
($mod_file = $module) =~ s,::,/,g;
$mod_file = "$lib/$mod_file.pm";
$fh = "${module}::DATA";
- my (@BEFORE_DATA, @AFTER_DATA);
+ my (@BEFORE_DATA, @AFTER_DATA, @AFTER_END);
@DATA = @STUBS = ();
open($fh,$mod_file) || die "Unable to open $mod_file";
@@ -47,9 +47,13 @@ sub stub {
|| die "$mod_file doesn't contain a __DATA__ token";
$found_selfloader ||
print 'die "\'use SelfLoader;\' statement NOT FOUND!!\n"',"\n";
- $self->_load_stubs($module);
+ if ($JUST_STUBS) {
+ $self->_load_stubs($module);
+ } else {
+ $self->_load_stubs($module, \@AFTER_END);
+ }
if ( fileno($fh) ) {
- $end = 1;
+ $end_data = 1;
while(defined($line = <$fh>)) {
push(@AFTER_DATA,$line);
}
@@ -60,7 +64,8 @@ sub stub {
print @STUBS;
unless ($JUST_STUBS) {
print "1;\n__DATA__\n",@DATA;
- if($end) { print "__END__\n",@AFTER_DATA; }
+ if($end_data) { print "__END__ DATA\n",@AFTER_DATA; }
+ if(@AFTER_END) { print "__END__\n",@AFTER_END; }
}
}