how to load Perl5's Data::Printer in Perl6?

橙三吉。 提交于 2019-12-05 04:57:25

Unsupported type NativeCall::Types::Pointer<94859011731840> in p5_to_p6

This was a bug in Inline::Perl that was fixed 4 days ago.

You will not get this lastest version if you simply do zef install Inline::Perl5. Here is what I did:

# Install a position independent version of perl, 
#   see  https://github.com/niner/Inline-Perl5/
$ perlbrew install perl-5.29.7 --as perl-5.29.7-PIC -Duseshrplib -Dusemultiplicity
$ perlbrew install-cpanm
$ perlbrew use perl-5.29.7-PIC
$ cpanm Data::Printer
$ git clone https://github.com/niner/Inline-Perl5.git
$ cd Inline-Perl5/
# Run: 'zef uninstall Inline::Perl5' first if you already have it installed
$ perl6 configure.pl6
$ make
$ make install # this installs the latest version of Inline::Perl5
$ cd ..

Then I tested this with this script (p.p6):

use Data::Printer:from<Perl5>;
my @a = 1,2,3,4;
p @a;

Running perl6 p.p6 gives now:

[
    [0] 1,
    [1] 2,
    [2] 3,
    [3] 4
]

Edit: If you already have installed a position independent perl binary, the above installation procedure can be simplified:

$ git clone https://github.com/niner/Inline-Perl5.git
$ cd Inline-Perl5/
$ zef uninstall Inline::Perl5
$ zef install . # or alternatively create the `Makefile` as above 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!