here is
THCB.pl. It is a candified "viewer" for telneting into the ChatterBox which does away with line endings but adds some color, a timer, and a log.
I say "viewer" because this can log you in and greet the CB if you enter a valid username and password. Otherwise, it will start telnet anyway and you can watch in anonymity.
My Question: THCB uses IPC w/autoflush because i would like to somehow pipe STDIN->TNOUT but can't figure out how to do that without interrupting the while loop.
#!/usr/bin/perl
use warnings;
use strict;
use Term::ANSIColor;
use IO::Handle;
use IPC::Open2;
$|=1;
print "User: ";
my $User=<>;
print "Pass: ";
my $Pass=<>;
open2(*TNIN, *TNOUT, "telnet desert-island.dynodns.net 4040");
TNOUT->autoflush(1);
open(LOG, ">THCB.log");
LOG->autoflush(1);
print TNOUT "auth ]$User [ $Pass";
my @c=("red","green","yellow","magenta");
my $n=0;
alarm 120; my $m=2;
while (<TNIN>) {
$SIG{ALRM}=sub{rearm()};
print LOG "$_";
if ($_ eq "Found you!\n") {print TNOUT "<i>exhaling...</i>\n"}
my @line = split / /; my $bit = shift @line; chomp @line;
if ($bit =~ /:$/) {
print color("blue on_cyan"), "$bit";
print color("reset");
}
else {print color("$c[$n]"), "$bit "}
print color("$c[$n]"), "@line ";
if ($n eq 3) {$n=0}
else {$n++}
}
sub rearm {
print color("white on_red"), "$m"; print "m";
print color("reset");
alarm 120; $m++; $m++;
}
NOTE: THCB does not yet log you out because you can't log out through telnet. You can log in repeatedly, but i recommend against this; eventually im2 sends little scoldings back.
Update: THCB is probably a *nix event