#!/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" ) });