in reply to Re^2: colored output
in thread colored output

That assumes perl 5.6.2 or higher. A more portable solution might be:
# check whether if.pm is available eval { use if 1, 'if' } ; my $has_if = defined $@ ; if ( $has_if ) { use if $^0 eq 'MSWin32', 'Win32::Console::ANSI' ; } elsif ( $^O eq 'MSWin32' ) { eval { use Win32::Console::ANSI } ; die "$@, stopped" if $@ ; }
</facetiousness>

Replies are listed 'Best First'.
Re^4: colored output
by ikegami (Patriarch) on Jan 04, 2005 at 04:59 UTC

    Good catch, thanks.

    In this case, it's probably sufficient to use only BEGIN { eval { require Win32::Console::ANSI; }; }