Skip to content

Commit

Permalink
Marshall data into Perl 6 from Parrot, moritz++
Browse files Browse the repository at this point in the history
We can now pass values into Perl 6 routines! This was accomplished by
defining a subroutine in Perl 6, and then executing and passing
arguments into it from PIR, instead of attempting to do that from Perl
6.
  • Loading branch information
leto committed Jul 28, 2010
1 parent d80522c commit bc5452c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 6 additions & 5 deletions plperl6.pir
Expand Up @@ -2,8 +2,8 @@
.param string code
.param pmc args :slurpy
args = convert_to_perl6_array(args)
$S0 = "my $r = eval q<<< sub {"
$S1 = "} >>>; $r.()"
$S0 = "eval q<<< sub (@_) {"
$S1 = "} >>>"
code = $S0 . code
code .= $S1
load_bytecode 'dumper.pbc'
Expand All @@ -13,11 +13,12 @@
$P1 = $P0.'compile'(code)
say "args="
_dumper(args)
$P2 = $P1(args)
$P2 = $P1()
$P3 = $P2(args)
print "code returned: "
_dumper($P2)
_dumper($P3)
say "=============="
.return($P2)
.return($P3)
.end

.sub convert_to_perl6_array
Expand Down
1 change: 0 additions & 1 deletion t/sql/plperl6.sql
Expand Up @@ -26,7 +26,6 @@ CREATE FUNCTION test_int_plperl6(integer) RETURNS int LANGUAGE plperl6 AS $$
$$;

CREATE FUNCTION test_arguments_plperl6(integer) RETURNS int LANGUAGE plperl6 AS $$
say '@_ = ', @_;
@_[0]
$$;

Expand Down

0 comments on commit bc5452c

Please sign in to comment.