Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: How to perldebug a Term::ReadLine application (the other way round)

by LanX (Cardinal)
on Dec 01, 2014 at 18:45 UTC ( #1108867=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to perldebug a Term::ReadLine application (the other way round)
in thread How to perldebug a Term::ReadLine application

well this works

PERLDB_OPTS="ReadLine=0" MASTER_TTY=`tty` xterm -e perl -d calc_TRL.pl

with

use Term::ReadLine; my $tty=$ENV{MASTER_TTY}; open my $out,'>',$tty; open my $in,'<',$tty; my $term = Term::ReadLine->new('Simple Perl calc',$in,$out); my $prompt = "Enter code: "; my $OUT = $term->OUT || \*STDOUT; while ( $_ = $term->readline($prompt) ) { my $res = eval($_); warn $@ if $@; print $OUT $res, "\n" unless $@; $term->addhistory($_) if /\S/; }

otherwise the debugger starts spontaneously to write to the master terminal, IMHO a bug somewhere between debugger and TRL.

My former approach to redirect the app's tty to a slave terminal has the advantage to run without lost of features in IDEs like emacs.

The slave terminal can also be an extra sub-window within the IDE running a terminal emulation.

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1108867]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2020-10-30 03:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (277 votes). Check out past polls.

    Notices?