Getting application ReadLine and Perl debugger ReadLine to cooperate



I have an example Perl script that uses Term::ReadLine::Gnu to provide
ReadLine support with command history:

#!/usr/local/bin/perl
use Term::ReadLine;
use Term::ReadLine::Gnu;

my $term = new Term::ReadLine "test";

while () {
$_ = $term->readline ("Command:");

last if !$_;

print "Read command: $_\n":
} # while

exit;

When run it runs fine, doesn't do much, but dutifully reads commands
and stores them in the history. IOW up arrow works to recall commands
and I can edit them. IOW Term::ReadLine::Gnu is installed properly and
functioning.

Now I wish to debug this script. So I do perl -d testReadLine.pl.
Initially the Perl debugger works. I can do commands like l for list
or s for step. However, as soon as I return from the new
Term::ReadLine the debugger is confused. No command does anything.

I fully suspect that the problem lies in the fact that both my Perl
script and the Perl debugger are fighting over STDIN/STDOUT and
confusing each other. The question is how to get them both to play
nice.

Suggestions? Workarounds? Solutions?
.



Relevant Pages

  • RE: question on redirecting output of Perl debugger commands
    ... I think what you suggested works fine for normal shell commands, ... Here's a sample session, ... bash-2.05b$ cat test.pl ... question on redirecting output of Perl debugger commands ...
    (perl.beginners)
  • Re: Getting application ReadLine and Perl debugger ReadLine to cooperate
    ... ReadLine support with command history: ... When run it runs fine, doesn't do much, but dutifully reads commands ... Initially the Perl debugger works. ...
    (comp.lang.perl.misc)
  • Re: [SLE] IPv6
    ... > This is initially confusing, but if you RTFM you will learn that what ... This, althought *most* noob's believe that you are being a smart-ass, ... not a lack of understand of the researched facts. ... For additional commands send e-mail to suse-linux-e-help@suse.com ...
    (SuSE)
  • Re: $current_path=`echo $cwd` does not work
    ... Backticks `` are supposed to be able to transfer the result of shell ... commands to Perl variable. ... But it's very confusing that it does not behave in the way that I ...
    (comp.lang.perl.misc)
  • Re: [opensuse] resurrecting a dead Gnome
    ... even know about the cat command, ... And no, 'dog' I don't use, it's just a curiosity. ... Too many commands can be confusing, so show just the usefull ones, and just mention others. ...
    (SuSE)