diff options
author | Peter Scott <Peter@PSDT.com> | 2001-09-13 08:26:31 -0700 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-09-14 02:31:05 +0000 |
commit | 5bad0d9e91a6a5b910e9a6a947ea1d762028bbab (patch) | |
tree | 890f4784da62e43ba36bbf544168f870ec155b2c /lib/perl5db.pl | |
parent | a5595fb984fdb4f5ee9a3cc14e9b23bf54c490eb (diff) | |
download | perl-5bad0d9e91a6a5b910e9a6a947ea1d762028bbab.tar.gz |
Execute files of debugger commands
Message-Id: <4.3.2.7.2.20010913115845.00b22100@mail.webquarry.com>
p4raw-id: //depot/perl@12014
Diffstat (limited to 'lib/perl5db.pl')
-rw-r--r-- | lib/perl5db.pl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/perl5db.pl b/lib/perl5db.pl index ab9c48da60..6f1b20a13d 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -1433,6 +1433,14 @@ EOP } } next CMD; }; + $cmd =~ /^\@\s*(.*\S)/ && do { + if (open my $fh, $1) { + push @cmdfhs, $fh; + } + else { + &warn("Can't execute `$1': $!\n"); + } + next CMD; }; $cmd =~ /^\|\|?\s*[^|]/ && do { if ($pager =~ /^\|/) { open(SAVEOUT,">&STDOUT") || &warn("Can't save STDOUT"); @@ -2105,6 +2113,11 @@ sub readline { } local $frame = 0; local $doret = -2; + while (@cmdfhs) { + my $line = CORE::readline($cmdfhs[-1]); + defined $line ? (print $OUT ">> $line" and return $line) + : close pop @cmdfhs; + } if (ref $OUT and UNIVERSAL::isa($OUT, 'IO::Socket::INET')) { $OUT->write(join('', @_)); my $stuff; @@ -2487,6 +2500,7 @@ B<$psh$psh> I<cmd> Run cmd in a subprocess (reads from DB::IN, writes to DB::O . ( $rc eq $sh ? "" : " B<$psh> [I<cmd>] Run I<cmd> in subshell (forces \"\$SHELL -c 'cmd'\")." ) . " See 'B<O> I<shellBang>' too. +B<@>I<file> Execute I<file> containing debugger commands (may nest). B<H> I<-number> Display last number commands (default all). B<p> I<expr> Same as \"I<print {DB::OUT} expr>\" in current package. B<|>I<dbcmd> Run debugger command, piping DB::OUT to current pager. |