Re: Need Inline::Perl5 help
On 03/05/2017 09:05 PM, Brock Wilcox wrote: 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 ; my $Red = color('red'); my $Reset = color('reset'); print ( $Red ~ "--Red--" ~ $Reset ~ "\n\n" ); You can also refer to this function with Term::ANSIColor::color(...). --Brock Thank you! -- ~~~ Having been erased, The document you're seeking Must now be retyped. ~~~
Re: Need Inline::Perl5 help
Followup, This is my notes on Inline::Perl5. I hope this is useful to others. -T #!/usr/bin/perl6 # Inline::Perl5 test # Reference: https://github.com/niner/Inline-Perl5/commit/cc683dae98df19db8cfbb551f7a87ef79bdc2a8b use Inline::Perl5; use Term::ANSIColor:from; # my $Red = Term::ANSIColor.RED; # my $Reset = Term::ANSIColor.RESET; my $Red = color('red'); my $Reset = color('reset'); print "High Level method:\n"; print $Red ~ "--Red--" ~ $Reset ~ "\n\n"; print "Low Level method:\n"; my $P5Color = Inline::Perl5.new; $P5Color.use( 'Term::ANSIColor' ); my $ResetColor = "RESET"; print ( $P5Color.call( 'Term::ANSIColor::GREEN' ) ~ "Red\n" ~ $P5Color.call( "Term::ANSIColor::$ResetColor" ) ~ "\n" ); my $p6str = "Perl 6 String"; my $perl5colors = Inline::Perl5.new(); $perl5colors.run(qq{ use Term::ANSIColor qw [ BLUE RESET ]; print "p5 term with color\n" . BLUE . "I am blue\n" . "$p6str" . RESET . "\n\n"; }); print "\'run\' method:\n"; my $perl5 = Inline::Perl5.new(); $perl5.run( ' print "Perl 5\' local time is " . localtime . "\n\n"; ' ); print "Test of return values\n"; my $RetStr = Inline::Perl5.new(); print $RetStr.run(qq{ return ( "P5 return string\n\n" ) });