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 ☆☆☆☆ :)
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.