468,321 Members | 1,674 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,321 developers. It's quick & easy.

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.computerhope.com/color.htm

Please let me know if anyone knows about it.
Thanks

Pramod
Jun 16 '08 #1
1 4976
Here is the answer :

Expand|Select|Wrap|Line Numbers
  1. use Win32::Console::ANSI;
  2. use Term::ANSIScreen qw/:color /;
  3.  
  4. print colored ("This text is bold green.\n", 'bold green');
  5. print "This text is normal.\n";
  6. print colored ['bold red'], "This text is bold red.\n";
  7. print "This text is normal.\n";  
Thanks to meloyelo :-)
Jun 17 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Hank | last post: by
5 posts views Thread by oddstray | last post: by
2 posts views Thread by John Smith | last post: by
6 posts views Thread by Ioannis Demetriades | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by howard w | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.