Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow re-using an existing Perl 5 interpreter
First step to support using Inline::Perl5 to implement Inline::Perl6
  • Loading branch information
niner committed Feb 7, 2015
1 parent bfa5003 commit 1a9085c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/Inline/Perl5.pm6
Expand Up @@ -3,6 +3,7 @@ class Inline::Perl5;
class Perl5Interpreter is repr('CPointer') { }

has Perl5Interpreter $!p5;
has Bool $!external_p5 = False;
has &!call_method;
has &!call_callable;

Expand Down Expand Up @@ -551,7 +552,7 @@ method use(Str $module, *@args) {
}

submethod DESTROY {
p5_destruct_perl($!p5) if $!p5;
p5_destruct_perl($!p5) if $!p5 and not $!external_p5;
$!p5 = Perl5Interpreter;
}

Expand Down Expand Up @@ -582,8 +583,9 @@ class Perl5Callable {
}

my $default_perl5;
method BUILD {
$!p5 = p5_init_perl();
method BUILD(:$p5) {
$!p5 = $p5 // p5_init_perl();
$!external_p5 = defined $p5;

&!call_method = sub (Int $index, Str $name, OpaquePointer $args, OpaquePointer $err) returns OpaquePointer {
my $p6obj = $objects.get($index);
Expand Down

0 comments on commit 1a9085c

Please sign in to comment.