Cannot import Perl5 module using Inline::Perl5 into Perl6

北城以北 提交于 2019-12-01 17:04:55

I think you stumbled on a bug in Inline::Perl5 that seems to happen for the Data::Printer Perl 5 module, so I would suggest you open an issue for it at https://github.com/niner/Inline-Perl5/issues .

Meanwhile, the syntax has become much simpler. Once you have Inline::Perl5 installed, you only need to add the :from<Perl5> adverb to load a module from Perl 5:

use Data::Printer:from<Perl5>;

Unfortunately, at this moment that creates the same error that you already described:

===SORRY!===
Unsupported type NativeCall::Types::Pointer<140393737675456> in p5_to_p6

So I don't think there is a solution this that wouldn't require an upgrade of either Inline::Perl5 or Rakudo Perl 6.

From the github page, https://github.com/niner/Inline-Perl5/issues/128

> perl6 -Ilib -e 'use Data::Printer:from<Perl5>; my @a = 1, 2, [3, 4, ${a => 1}]; p @a'
[
    [0] 1,
    [1] 2,
    [2] [
        [0] 3,
        [1] 4,
        [2] {
            a   1
        } (tied to Perl6::Hash)
    ]
]

I'm not particularly happy with this though. This is much more complicated than perl5 would have been. One of the main points of using Perl6 over Perl5 is simpler use and syntax. This isn't it. The 'Inline::Perl5' module should be able to be loaded within the script like every other module, not as an option at the command line.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!