in reply to Re: Term::ANSIColor is awesome, but.. (need help) (overload and override)
in thread Term::ANSIColor is awesome, but.. (need help)

I had the very same idea but I was thinking of using a global variable. A class variable - or a class attribute - is much better. Thank you!

And a good thing is that it should also work for exceptions, if I also create a die_color() function.

1. If I implement this, is it worth sharing it on CPAN?

2. Is it "bad practice"?

3. Is there a better way?

I really like the idea of a string declared with a color, but who behaves just like a normal string in the program. Only the display is colored.

  • Comment on Re^2: Term::ANSIColor is awesome, but.. (need help) (overload and override)

Replies are listed 'Best First'.
Re^3: Term::ANSIColor is awesome, but.. (need help) (overload and override)
by mascip (Pilgrim) on Mar 31, 2014 at 14:35 UTC

    I would really like to hear people's feedback: Is this String::Colored module a good / bad idea ?

Re^3: Term::ANSIColor is awesome, but.. (need help) (overload and override)
by mascip (Pilgrim) on Apr 01, 2014 at 12:34 UTC

    Additional idea given by a Monger:

    local *CORE::GLOBAL::print = \&String::Colored::sing;
    That's if I want to not need to change anything in my current code, while adding colors. Any warnings against the dangers of this trick would be very welcome :-)

      That's what "Override the output functions you use (like 'print')" means.

      - tye        

        Indeed (^c^) Thank you tye