Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: colored output

by belden (Friar)
on Jan 03, 2005 at 23:59 UTC ( [id://419105]=note: print w/replies, xml ) Need Help??


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; }; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://419105]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (12)
As of 2024-04-16 07:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found