Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent inherited Any methods from interfering with calls to P5 methods
Perl5Object inherits methods like "push" and "list" from Any. This prevents the fallback that passes calls to such methods to the wrapped P5 object from kicking in. Work around that by explicitly adding wrapper methods. Thanks to lizmat++ for giving the inspiration.
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env perl6 | ||
|
||
use v6; | ||
use Inline::Perl5; | ||
use Test; | ||
|
||
my $p5 = Inline::Perl5.new; | ||
|
||
$p5.run: q:heredoc/PERL5/; | ||
package Foo; | ||
sub new { | ||
return bless {}; | ||
} | ||
sub push { | ||
return 'pushed'; | ||
} | ||
PERL5 | ||
|
||
my $foo = $p5.invoke('Foo', 'new'); | ||
|
||
is($foo.push, 'pushed'); | ||
|
||
done; |