kubrat has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Term::ReadLine and Term::ANSIColor don't play well on Windows
by hdb (Monsignor) on Mar 26, 2013 at 16:16 UTC | |
by kubrat (Scribe) on Mar 26, 2013 at 20:18 UTC | |
by LanX (Saint) on Mar 26, 2013 at 21:04 UTC | |
|
Re: Term::ReadLine and Term::ANSIColor don't play well on Windows
by Anonymous Monk on Mar 26, 2013 at 16:35 UTC | |
by kubrat (Scribe) on Mar 26, 2013 at 20:27 UTC | |
|
Re: Term::ReadLine and Term::ANSIColor don't play well on Windows
by kubrat (Scribe) on Mar 27, 2013 at 12:28 UTC |