raku

How can I use Perl 5 modules from Perl 6?

亡梦爱人 提交于 2019-12-21 03:32:50
问题 Is the a way to use Perl 5 modules from CPAN from Rakudo Perl 6? For example, how can I use the venerable Perl 5 module, CGI, which hasn't been ported yet, in Perl 6. Update: And what this funky code from some early Perl 6 module: use CGI:from<perl5>; Is the :from<perl5> directive used to evoke some kind of a Perl 5 compatibility layer? Can't seem to find any documentation about it. 回答1: Use Inline::Perl5. The following example shows how to use the CPAN hosted Perl 5 module Text::Unidecode (

How does Parrot compare to other virtual machines?

笑着哭i 提交于 2019-12-20 09:14:40
问题 Parrot is the virtual machine originally designed for Perl 6. What technical capabilities does the Parrot VM offer that competing virtual machines such as the Java Virtual Machine (JVM)/Hotspot VM and Common Language Runtime (CLR) lack? 回答1: The following answer was written in 2009. See also this 2015 update by raiph. To expand on @Reed and point out some highlights, Parrot's opcodes are at a far higher level than most virtual machines. For example, while most machines store integers and

How does Parrot compare to other virtual machines?

六月ゝ 毕业季﹏ 提交于 2019-12-20 09:14:17
问题 Parrot is the virtual machine originally designed for Perl 6. What technical capabilities does the Parrot VM offer that competing virtual machines such as the Java Virtual Machine (JVM)/Hotspot VM and Common Language Runtime (CLR) lack? 回答1: The following answer was written in 2009. See also this 2015 update by raiph. To expand on @Reed and point out some highlights, Parrot's opcodes are at a far higher level than most virtual machines. For example, while most machines store integers and

What's the deal with all the different Perl 6 equality operators? (==, ===, eq, eqv, ~~, =:=, …)

一世执手 提交于 2019-12-20 09:06:25
问题 Perl 6 seems to have an explosion of equality operators. What is =:= ? What's the difference between leg and cmp ? Or eqv and === ? Does anyone have a good summary? 回答1: =:= tests if two containers (variables or items of arrays or hashes) are aliased, ie if one changes, does the other change as well? my $x; my @a = 1, 2, 3; # $x =:= @a[0] is false $x := @a[0]; # now $x == 1, and $x =:= @a[0] is true $x = 4; # now @a is 4, 2, 3 As for the others: === tests if two references point to the same

How to add subscripts to my custom Class in Perl 6?

纵然是瞬间 提交于 2019-12-20 03:10:41
问题 I am new to Perl 6. I have the following code in my Atom Editor, but I still don't understand how this works. I copied the following code, as the docs.raku.org said, but it seems that it does not work. So I changed the code to this: use v6; class HTTPHeader { ... } class HTTPHeader does Associative { has %!fields handles <self.AT-KEY self.EXISTS-KEY self.DELETE-KEY self.push list kv keys values>; method Str { say self.hash.fmt; } multi method EXISTS-KEY ($key) { %!fields{normalize-key $key}

Are perl5 libraries are importable in perl6?

前提是你 提交于 2019-12-19 19:17:25
问题 I know that perl6 will definetely allow importing perl5 code but I'm not able to do this. Here is perl6 code use perl5:Net::FTP; It reports an error Is there any configuration issue or it is not ready yet? 回答1: Use Inline::Perl5 to embed arbitrary Perl code in Raku or use Perl libraries as if they were Raku libraries. Inline::Perl5 appropriately packages and wraps a regular perl interpreter in MoarVM so that Rakudo can interop with Perl. The combination already supports: use ing Perl modules,

Cannot import Perl5 module using Inline::Perl5 into Perl6

我是研究僧i 提交于 2019-12-19 18:32:14
问题 I'm trying to import a Perl5 module I really like https://metacpan.org/pod/Data::Printer using 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'); but then I get this error: 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

Cannot import Perl5 module using Inline::Perl5 into Perl6

南笙酒味 提交于 2019-12-19 18:31:54
问题 I'm trying to import a Perl5 module I really like https://metacpan.org/pod/Data::Printer using 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'); but then I get this error: 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

Is there a way to get the version from META6.json in Perl6 module code?

谁说我不能喝 提交于 2019-12-19 17:37:33
问题 I want to do something like this: die "Fatal error: application version $MY-APPLICATION-VERSION" Since a Perl6 module cannot assume the relative locations of files it was packaged with (for instance installed modules are all put into a flat directory structure) I can't just do $?FILE.IO.add("../META6.json").slurp . Is there a way to get the version declared in META6.json in a Perl6 app/module that may or may not be installed? 回答1: As of rakudo v2019.03 modules may access the Distribution

Is there a way to get the version from META6.json in Perl6 module code?

隐身守侯 提交于 2019-12-19 17:37:19
问题 I want to do something like this: die "Fatal error: application version $MY-APPLICATION-VERSION" Since a Perl6 module cannot assume the relative locations of files it was packaged with (for instance installed modules are all put into a flat directory structure) I can't just do $?FILE.IO.add("../META6.json").slurp . Is there a way to get the version declared in META6.json in a Perl6 app/module that may or may not be installed? 回答1: As of rakudo v2019.03 modules may access the Distribution