Changing text color of windows command propmpt through PERL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pramodkh
    New Member
    • Nov 2007
    • 23

    Changing text color of windows command propmpt through PERL

    Dear All,

    I am writting a PERL script in windows to test some test cases. The test result is captured both in command prompt and in the log file. But when the result is displayed on a windows command prompt, its very difficult to read the output text. Instead I was thinking of changing the text color of the command prompt. I mean if the test case passes...then the result will be displayed in Green color and in case of any errors/failures, display it in a red color.

    I did some googling and found the following link which will explain how to change text color in windows. But i was wondering how do i do it through perl script to display only selected text messages in a particular color?

    http://www.computerhop e.com/color.htm

    Please let me know if anyone knows about it.
    Thanks

    Pramod
  • pramodkh
    New Member
    • Nov 2007
    • 23

    #2
    Here is the answer :

    Code:
    use Win32::Console::ANSI;
    use Term::ANSIScreen qw/:color /;
    
    print colored ("This text is bold green.\n", 'bold green');
    print "This text is normal.\n";
    print colored ['bold red'], "This text is bold red.\n";
    print "This text is normal.\n";
    Thanks to meloyelo :-)

    Comment

    Working...