niner / Inline-Perl5

Use Perl 5 code in a Raku program
Artistic License 2.0
95 stars 30 forks source link

Example in the documentation does not work - Undefined subroutine &main::print called #181

Open oldcoder47 opened 1 year ago

oldcoder47 commented 1 year ago

Verbatim from your documentation: use Inline::Perl5;

my $p5 = Inline::Perl5.new;

$p5.call('print', 'Hello World');

results in:
Undefined subroutine &main::print called.

in method handle_p5_exception at /.rakubrew/versions/moar-2022.12/share/perl6/site/sources/FE0EA2E16CD0CD31716830FEE610E9B4116A2281 (Inline::Perl5) line 345 in method call at /.rakubrew/versions/moar-2022.12/share/perl6/site/sources/FE0EA2E16CD0CD31716830FEE610E9B4116A2281 (Inline::Perl5) line 431 in block at P5Test.raku line 5

I am running on Windows 11 WSL2 Ubuntu 20.04 where I used rakubrew to get raku and raku -v shows Built on MoarVM version 2022.12.

niner commented 1 year ago

Indeed, that's a bug in the documentation. The example would work with any other function. More precicely: with any function, as print actually is not one, but instead is a keyword. That's why EVAL 'print "hello world"', :lang<Perl5> works fine, but the low level version doesn't. Will replace the example.