Skip to content

Commit

Permalink
Perlito5 - add a simple impl of multi eval($str, :$lang! where "perl5")
Browse files Browse the repository at this point in the history
  • Loading branch information
fglock committed May 26, 2012
1 parent 02db591 commit 91820ec
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions perl6-eval.p6
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use v6;

multi eval($str, :$lang! where 'perl5') {
my $inp_file = "tmp.p5";
my $out_file = "tmp.p6";
my $fh = open($inp_file, :w);
$fh.print($str);
$fh.close;
shell "perl perlito5.pl -Isrc5/lib -Cperl6 $inp_file > $out_file";
my $p6_str = slurp $out_file;
say "[[$p6_str]]";
eval($p6_str, :lang<perl6>);
}

my $p5_str = "say 'hello, World!'";
#eval $p5_str;
eval($p5_str, :lang<perl5>);

0 comments on commit 91820ec

Please sign in to comment.