in reply to bidirectional challange
I couldn't figure a way to channel STDIN->TNOUT, but you could use $SIG{INT} as something to "listen for" along with the alarm, so the user can interrupt and input a line. That means you need a new way to conviently kill the whole thing (input DONE). Since TNIN is triggered initially by im2 starting the timer:
I just tried it and it werx dandy. ROLL ON
insert this line after that:$SIG{ALRM}=sub{rearm()};
and for the sub:$SIG{INT}=sub{process()};
now, when you press ctrl-c, instead of death you get a little ">" prompt so you can talk.sub process { print color("black on_white"), ">"; print color("reset"); my $input=<>; if ($input eq "DONE\n") {exit 0} else {print TNOUT "$input"} }
I just tried it and it werx dandy. ROLL ON
|
---|
In Section
Seekers of Perl Wisdom