in reply to Term::ANSIColor and DIE

ITYM that it includes the line number information, not $!. But that's because your string doesn't end with \n, it's ending in whatever sequence of escape characters RESET expands out to. You want to put the "\n\n" after the RESET.

. . . die RED, "Blah blah", RESET, "\n";

Update: And you might want to test if STDERR is a tty or not before adding escapes to it in case the user is saving it into a file.

sub maybe_color { my $msg = shift; $msg = RED . $msg . RESET if -t STDERR; return $msg; }

Replies are listed 'Best First'.
Re^2: Term::ANSIColor and DIE
by ghenry (Vicar) on May 23, 2005 at 13:23 UTC

    Ah, yes. I completely forgot about the \n rule.

    Thanks for this and the sub. I'll incorporate that test in my code if you don't mind ;-)

    Gavin.

    Walking the road to enlightenment... I found a penguin and a camel on the way.....
    Fancy a yourname@perl.me.uk? Just ask!!!