Skip to content

Commit

Permalink
Use the same mechanism for merging Perl 5 symbols as for Perl 6
Browse files Browse the repository at this point in the history
Have Inline::Perl5 create a CompUnit::Handle that contains all relevant
symbols and merge them like any other globals instead of relying on side
effects and implementation details to get those symbols into the user's
name space.
  • Loading branch information
niner committed Jan 28, 2017
1 parent a256ef2 commit 4e7ab20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/CompUnit/Handle.pm
Expand Up @@ -69,7 +69,7 @@ class CompUnit::Handle {
nqp::if(
nqp::defined($!module_ctx),
nqp::ifnull(nqp::atkey(nqp::ctxlexpad($!module_ctx),'GLOBALish').WHO, Nil),
Nil
nqp::if(nqp::defined($!unit), $!unit, Nil)
)
}

Expand Down
5 changes: 3 additions & 2 deletions src/core/CompUnit/Repository/Perl5.pm
Expand Up @@ -12,13 +12,14 @@ class CompUnit::Repository::Perl5 does CompUnit::Repository {
if $*RAKUDO_MODULE_DEBUG -> $RMD {
$RMD("Loading {$spec.short-name} via Inline::Perl5");
}
$perl5.require(
my $handle := $perl5.require(
$spec.short-name,
$spec.version-matcher !== True ?? $spec.version-matcher.Num !! Num,
:handle
);
return CompUnit.new(
:short-name($spec.short-name),
:handle(CompUnit::Handle.from-unit(::($spec.short-name).WHO)),
:$handle,
:repo(self),
:repo-id($spec.short-name),
:from($spec.from),
Expand Down

0 comments on commit 4e7ab20

Please sign in to comment.