Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Final piece for Inline::Perl6 implementation
Set up a callback function that can be used to create an Inline::Perl5 object
for bootstrapping Inline::Perl6.
  • Loading branch information
niner committed Feb 7, 2015
1 parent f2963bb commit 21ff27d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/Inline/Perl5.pm6
Expand Up @@ -682,6 +682,19 @@ class Perl5ModuleLoader {

nqp::getcurhllsym('ModuleLoader').p6ml.register_language_module_loader('Perl5', Perl5ModuleLoader);

my Bool $inline_perl6_in_use = False;
sub init_inline_perl6_new_callback(&inline_perl5_new (Perl5Interpreter --> OpaquePointer)) { ... };

our sub init_inline_perl6_callback(Str $path) {
$inline_perl6_in_use = True;
trait_mod:<is>(&init_inline_perl6_new_callback, :native($path));

init_inline_perl6_new_callback(sub (Perl5Interpreter $p5) {
my $self = Inline::Perl5.new(:p5($p5));
return $self.p6_to_p5($self);
});
}

END {
p5_terminate;
p5_terminate unless $inline_perl6_in_use;
}

0 comments on commit 21ff27d

Please sign in to comment.