Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Need Perl6: Inline::Perl5 help

by Todd Chester (Scribe)
on Mar 06, 2017 at 07:22 UTC ( [id://1183736]=note: print w/replies, xml ) Need Help??


in reply to Re: Need Perl6: Inline::Perl5 help
in thread Need Perl6: Inline::Perl5 help

Thank you all for the help and tips!

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/cc683dae98df +19db8cfbb551f7a87ef79bdc2a8b use Inline::Perl5; use Term::ANSIColor:from<Perl5>; # 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" ) });

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1183736]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-03-28 13:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found