本文介绍了无法使用 Inline::Perl5 将 Perl5 模块导入 Perl6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试导入我非常喜欢的 Perl5 模块 https://metacpan.org/pod/数据::打印机使用手册页中的建议 https://modules.perl6.org/dist/Inline::Perl5:cpan:NINE

I'm trying to import a Perl5 module I really like https://metacpan.org/pod/Data::Printerusing advice from the manual page https://modules.perl6.org/dist/Inline::Perl5:cpan:NINE

使用一个非常简单的脚本

using a very simple script

use Inline::Perl5;
my $p5 = Inline::Perl5.new;
$p5.use('Data::Printer');

但后来我收到此错误:

Unsupported type NativeCall::Types::Pointer<94774650480224> in p5_to_p6
  in method p5_to_p6_type at /usr/lib/perl6/site/sources/130449F27E85303EEC9A19017246A5ED249F99E4 (Inline::Perl5) line 298
  in method unpack_return_values at /usr/lib/perl6/site/sources/130449F27E85303EEC9A19017246A5ED249F99E4 (Inline::Perl5) line 375
  in method invoke at /usr/lib/perl6/site/sources/130449F27E85303EEC9A19017246A5ED249F99E4 (Inline::Perl5) line 446
  in method import at /usr/lib/perl6/site/sources/130449F27E85303EEC9A19017246A5ED249F99E4 (Inline::Perl5) line 776
  in method use at /usr/lib/perl6/site/sources/130449F27E85303EEC9A19017246A5ED249F99E4 (Inline::Perl5) line 898
  in block <unit> at inline_perl5.p6 line 4

这里出了什么问题?如何将此 perl5 模块导入 perl6?如果有一种类似的方法可以在 Perl6 中获取彩色/选项卡式输出,就像我从 Data::Printer 中获取的那样,我也会很高兴,因为我找不到它.

what is going wrong here? How can I import this perl5 module into perl6? I would also be happy if there is a similar way to get the colored/tabbed output in Perl6 like I would get from Data::Printer because I can't find it.

这里解决了:如何加载 Perl5 的数据::打印机在 Perl6 中?

推荐答案

我认为您偶然发现了 Inline::Perl5 中的一个错误,该错误似乎发生在 Data::Printer Perl 5 模块,所以我建议你在 https://github 上为它打开一个问题.com/niner/Inline-Perl5/issues .

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 .

与此同时,语法变得更加简单.一旦你安装了 Inline::Perl5,你只需要添加 :from 副词来从 Perl 5 加载一个模块:

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

所以我认为没有一种解决方案不需要升级 Inline::Perl5 或 Rakudo Perl 6.

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

这篇关于无法使用 Inline::Perl5 将 Perl5 模块导入 Perl6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-05 07:52