Dear Monks,
The following example code works as expected on Linux:
use Term::ANSIColor;
use Term::ReadLine;
my $term = new Term::ReadLine 'Simple Perl calc';
my $prompt = "Enter your arithmetic expression: ";
my $OUT = $term->OUT || STDOUT;
while ( defined ($_ = $term->readline($prompt)) ) {
$res = eval($_);
warn $@ if $@;
print $OUT color('green');
print $OUT $res, "\n" unless $@;
print $OUT color('reset');
$term->addhistory($_) if /\S/;
}
However, on Windows (win7 to be precise) instead of a green coloured $res I get the ANSI escape characters, e.g. <-[32m4<-[0m
The strange thing is that otherwise ANSIColor works on Windows if you print directly to the console.
Peace.