On 02/26/2017 04:13 AM, ToddAndMargo wrote:
Hi All,

Reference: https://github.com/tadzik/Terminal-ANSIColor/

How do I clean this Perl 5 line for Perl 6?

44:  use Terminal::ANSIColor qw( BOLD BLUE RED GREEN RESET );

# perl6 -c CimTrakCheckAndResatart.pl6
===SORRY!=== Error while compiling
/home/linuxutil/CimTrakCheckAndResatart.pl6
Undeclared names:
    BLUE used at line 44
    BOLD used at line 44
    GREEN used at line 44
    RED used at line 44
    RESET used at line 44
Undeclared routine:
    qw used at line 44


Many thanks,
-T




Follow up: this is what I wound up with:

<code>
#!/usr/bin/perl6

use Terminal::ANSIColor;

sub PrintRed ( $Str ) { print color('bold'), color('red'), "$Str", color('reset'); } sub PrintGreen ( $Str ) { print color('bold'), color('green'), "$Str", color('reset'); } sub PrintBlue ( $Str ) { print color('bold'), color('blue'), "$Str", color('reset'); }

PrintRed   "I Am Red\n";
PrintGreen "I Am Green\n";
PrintBlue  "I Am Blue\n";
print      "Back to Reset\n\n";
</code>

$ ./Color.pl6
I Am Red
I Am Green
I Am Blue
Back to Reset


Thank you all for the help!
-T

Reply via email to