Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Win32::Console issue

by krosty (Initiate)
on Nov 13, 2012 at 19:26 UTC ( #1003691=perlquestion: print w/ replies, xml ) Need Help??
krosty has asked for the wisdom of the Perl Monks concerning the following question:

I'm using Win32::Console for my console output. I have one .pl file (this is main) calling few other .pl files. The subs are scattered across the files. I'm using following code snippet using the module wherever I need to print something to console. The object is created once obviously in the main script.
$CONSOLE = Win32::Console->new(STD_OUTPUT_HANDLE); #in main $attr = $CONSOLE->Attr(); # Get current console colors $CONSOLE->Attr($FG_RED | $BG_BLACK); # red text on black print "Hello world!\n"; $CONSOLE->Attr($attr); # Set console colors back to original
But I'm not seeing the colored outputs when the print command is in a sub which is in one of the called files. The print from the sub in the main file is working. I'm using the latest ActivePerl community edition.

Comment on Win32::Console issue
Download Code
Re: Win32::Console issue
by Anonymous Monk on Nov 14, 2012 at 04:04 UTC

    I have one .pl file (this is main) calling few other .pl files.

    Whats that mean?

Re: Win32::Console issue
by Anonymous Monk on Nov 14, 2012 at 15:00 UTC
    Our logic is spread over several perl files. By 'main', I meant, the script that is executed with the 'perl' command. It uses 'require' function to instruct the interpreter to use the other files.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1003691]
Approved by herveus
Front-paged by bulk88
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2014-08-01 09:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (0 votes), past polls