Another ... maybe saner way ... to do it is to attach the application explicitely to another TTY.

Ideally a module could sense if it's run within the debugger and automatically set the TTY.

For instance xterm -e perl -e 'print `tty`;sleep' will show the TTY of this terminal ( /dev/pts/5 in this case) and sleep indefintely to not disturb the TTY output.

the following script hardcodes that TTY into TRL:

use Term::ReadLine; my $tty='/dev/pts/5'; 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/; }

I have problems to figure out a nice way to automize it. Ideally I'd get the TTY of the spawned xterm returned.

The only thing I figured out at the moment is to look into the proces table

> ls -l /proc/31965/fd/ insgesamt 0 lrwx------ 1 lanx lanx 64 Dez 1 17:18 0 -> /dev/pts/5 lrwx------ 1 lanx lanx 64 Dez 1 17:18 1 -> /dev/pts/5 lrwx------ 1 lanx lanx 64 Dez 1 17:18 2 -> /dev/pts/5

Cheers Rolf

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


In reply to Re: How to perldebug a Term::ReadLine application (the other way round) by LanX
in thread How to perldebug a Term::ReadLine application by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.