Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Getting application ReadLine and Perl debugger ReadLine to cooperate

Reply
Thread Tools

Getting application ReadLine and Perl debugger ReadLine to cooperate

 
 
Andrew DeFaria
Guest
Posts: n/a
 
      01-30-2008
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?
 
Reply With Quote
 
 
 
 
Ben Morrow
Guest
Posts: n/a
 
      01-30-2008

Quoth Andrew DeFaria <(E-Mail Removed)>:
> 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;
>

<snip>
>
> 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.


It may also be because the debugger is also using Term::Readline::Gnu. I
don't know if the underlying readline library can cope with two users at
once. You may want to try the debugger options TTY and ReadLine (see
perldoc perldebug).

Ben

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help getting a debugger going for IE - any free debugger aflat362 Javascript 7 12-07-2006 10:51 PM
806 refusing to cooperate. Sol Cisco 10 04-27-2006 05:42 AM
document.onload and getElementById() don't cooperate Erwin Moller Javascript 12 01-05-2006 04:57 PM
Business opportunity: Cooperate with us in the field of Audio&Video products! Jenny Jiang DVD Video 0 01-13-2005 08:21 AM
Union, ternary operator, Macro, printf don't cooperate for me. Help? Paul E Johnson C Programming 2 10-17-2003 06:41 AM



Advertisments