Looks like Term::ANSIColor does weird things with exported constants --
they are some sort of constant-function rather than simple strings. Here is
an alternate usage that does what you want:

#!/usr/bin/perl6
use Inline::Perl5;
use Term::ANSIColor:from<Perl5> <color>;

my $Red   = color('red');
my $Reset = color('reset');
print ( $Red ~ "--Red--" ~ $Reset ~ "\n\n" );
</code>

You can also refer to this function with Term::ANSIColor::color(...).

--Brock




On Sat, Mar 4, 2017 at 1:15 AM, ToddAndMargo <toddandma...@zoho.com> wrote:

> Hi All,
>
> I am trying to write myself an example of how
> to use Inline::Perl5  (yes, I know there is a way
> to write in color in Perl 6).
>
> I also have a low level test(.use), which I am not
> showing, as it works.
>
> I am doing this in an Xfce 4.12 (Linux) "Terminal".
>
>
> <code>
> #!/usr/bin/perl6
> use Inline::Perl5;
> use Term::ANSIColor:from<Perl5>;
>
> my $Red   = Term::ANSIColor.RED;
> my $Reset = Term::ANSIColor.RESET;
> print ( $Red ~ "--Red--" ~ $Reset ~ "\n\n" );
> </code>
>
> Term::ANSIColor--Red--Term::ANSIColor
> ^^^^^^^^^^^^^^^^^^^^^^  is printing in red
>                       ^^^^^^^^^^^^^^^ is back to black
>
> Why is it printing out "Term::ANSIColor"?
>
> Many thanks,
> -T
>
> ~~~~~~~~~~~~~~~~~~~~~~~~
> Yesterday it worked.
> Today it is not working.
> Windows is like that.
> ~~~~~~~~~~~~~~~~~~~~~~~~
>

Reply via email to