我正在尝试在Raspberry Pi 3上安装Rakudo Star 2018.04.
我做:
sudo perl Configure.pl --gen-moar --gen-nqp --prefix ~/rakudo
Run Code Online (Sandbox Code Playgroud)
它成功完成.
然后我尝试:
sudo make-install
Run Code Online (Sandbox Code Playgroud)
但它失败了:
The following step can take a long time, please be patient.
/home/pi/rakudo/bin/moar --libpath="blib" --libpath="/home/pi/rakudo/share/nqp/lib" --libpath="/home/pi/rakudo/share/nqp/lib" perl6.moarvm --nqp-lib=blib --setting=NULL --ll-exception --optimize=3 --target=mbc --stagestats --output=CORE.setting.moarvm gen/moar/CORE.setting
Stage start : 0.000
Stage parse : 459.019
Stage syntaxcheck: 0.000
Stage ast : 0.000
Stage optimize : Killed
Makefile:504: recipe for target 'CORE.setting.moarvm' failed
make[1]: *** [CORE.setting.moarvm] Error 137
make[1]: Leaving directory '/home/pi/rakudo-star-2018.04/rakudo'
Makefile:43: recipe for target …
Run Code Online (Sandbox Code Playgroud) 自从我看到 Jonathan Worthington 在 YouTube 视频 A Raku API to Raku 中展示新的 RakuAST 以来,距离 TRC 2021 为止的旅程已经过去了快一年了。在视频中,他展示了我们可以使用RAKUDO_RAKUAST=1
如下方式转储这个新的 RakuAST:
RAKUDO_RAKUAST=1 raku --target=ast -e 'say [*] 1..10'
Run Code Online (Sandbox Code Playgroud)
我正在使用 RakudoStar 的最新版本,但是上面的命令仍然转储旧的 QAST 树。
这里发生了什么?
为什么它不显示新的 RakuAST,我怎样才能以正确的方式编译 rakudo 以便它显示?
对于构建,我使用此页面https://rakudo.org/downloads/rakudo/source for Linux 上的说明,并稍作修改,因为这些说明稍微过时了。这就是我所做的,而不是页面告诉我的(它以前有效,但现在不再有效):
sudo perl Configure.pl --backends=moar --gen-moar --gen-nqp
Run Code Online (Sandbox Code Playgroud) 在使用用户定义的变量时,有没有"@" - sigil我不能做的事情?
#!perl6
use v6;
my $list = <a b c d e f>;
my @list = <a b c d e f>;
$list.list.perl.say;
@list.perl.say;
$list[2..4].say;
@list[2..4].say;
$list.elems.say;
@list.elems.say;
$list.end.say;
@list.end.say;
say 'OK' if $list ~~ /^c$/;
say 'OK' if @list ~~ /^c$/;
Run Code Online (Sandbox Code Playgroud) 今天我安装了Rakudo Star 2012.07并尝试编写一个简单的Perl 6脚本:
#!/usr/bin/env perl6
use v6;
use LWP::Simple;
my $html = LWP::Simple.get('http://perl6.org');
say $html;
Run Code Online (Sandbox Code Playgroud)
由于以下错误,它无法正常工作:
No such method 'get_string' for invocant of type 'String'
in method decode at src/gen/CORE.setting:6766
in method parse_response at lib/LWP/Simple.pm:244
in method make_request at lib/LWP/Simple.pm:199
in method request_shell at lib/LWP/Simple.pm:63
in method get at lib/LWP/Simple.pm:28
Run Code Online (Sandbox Code Playgroud)
第244行的LWP ::简单代码是:
my @header_lines = $resp.subbuf(
0, $header_end_pos
).decode('ascii').split(/\r\n/);
Run Code Online (Sandbox Code Playgroud)
奇怪的是,以下代码是可以的:
> Buf.new(1,2,3,4,5).decode('ascii')
Run Code Online (Sandbox Code Playgroud)
而这一次失败了:
> Buf.new(1,2,3,4,5).subbuf(0,3).decode('ascii')
Method 'get_string' not found for invocant of class 'String'
Run Code Online (Sandbox Code Playgroud)
你能解释一下,为什么会这样?据我所知,在两种情况下都调用Buf.decode方法:
> Buf.new(1,2,3,4,5).subbuf(0,3).isa('Buf')
True
> …
Run Code Online (Sandbox Code Playgroud) 我很想学习Raku(Perl 6)及其语法。
我的Ubuntu计算机上已经安装了Perl 5。
vinod@ubuntu-s-1vcpu-1gb-nyc1-01:~$ perl -v
This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi
(with 67 registered patches, see perl -V for more detail)
Copyright 1987-2017, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc …
Run Code Online (Sandbox Code Playgroud) 当我尝试MSYS2-64
在Windows 7的(bash.exe)上运行简单的perl6脚本时,它说:
Could not open my-perl6-script.pl. Failed to stat file: no such file or directory
Run Code Online (Sandbox Code Playgroud)
相同的脚本可以很好地运行,CMD.exe
因此我认为perl6和MSYS2之间有些不兼容。
$ perl6 -v
返回:
This is Rakudo Star version 2018.04.1 built on MoarVM version 2018.04.1 implementing Perl 6.c.
Run Code Online (Sandbox Code Playgroud)
perl6的bin文件夹是:
-rwxr-xr-x 1 win7 None 537938 May 11 2015 libgcc_s_sjlj-1.dll
-rw-r--r-- 1 win7 None 130262 May 7 2018 libmoar.dll.a
-rwxr-xr-x 1 win7 None 57681 May 11 2015 libwinpthread-1.dll
-rwxr-xr-x 1 win7 None 6633702 May 7 2018 moar.dll
-rwxr-xr-x 1 win7 None 57225 …
Run Code Online (Sandbox Code Playgroud) 我有以下项目
$ tree
.
??? lib
? ??? MyModule.raku
??? main.raku
$ cat lib/MyModule.raku
use v6;
unit module MyModule;
sub hello { say 'hello' }
$ cat lib/main.raku
use v6;
use MyModule;
MyModule.hello();
Run Code Online (Sandbox Code Playgroud)
我想使用最新的rakudo-star
图像运行 main.raku 。但是会出现以下情况
$ docker run -i --rm -u $(id -u) \
--workdir /work \
--volume $PWD:/work \
--entrypoint bash \
rakudo-star perl6 -I ./lib main.raku
===SORRY!===
Could not find MyModule at line 3 in:
file#/work/lib
inst#/.perl6
inst#/usr/share/perl6/site
inst#/usr/share/perl6/vendor
inst#/usr/share/perl6
ap#
nqp#
perl5#
Run Code Online (Sandbox Code Playgroud)
我之前也试过在 …
我一直在尝试在Rakudo Perl中运行一些套接字代码(刚从http://github.com/rakudo/rakudo的存储库构建),但IO :: Socket :: INET的实现似乎不完整.
我试图运行的代码在这里:http://github.com/carlins/irc-client/blob/master/lib/IRC/Client.pm
这是错误:
Method 'input-line-separator' not found for invocant of class 'IO;Socket;INET' in 'IRC::Client::connect' at line 30:lib/IRC/Client.pm in main program body at line 13:example.pl
从官方tarball构建的Rakudo Star也会发生同样的事情.指针?
下面使用声明的目的是什么,我偶然发现了一些Perl 6模块?
use CGI:from<perl5>;
...
...
Run Code Online (Sandbox Code Playgroud)
其余的代码只是普通的Perl 5 CGI模块的使用,据我所知.
是否使用":from"后缀来调用某种Perl 5兼容层.似乎找不到任何关于它的文档.
Rakudo Star是面向最终用户的版本(如果我没有记错的话).因此,它包括许多可用于各种项目的有用模块.
但它背后的团队如何决定包含哪些模块?模块开发人员是否与他们交谈并要求包含,或者他们是否查看使用统计信息并包含最受欢迎的?或者包含完全武断?
应该通过什么过程来获得他们的模块?
rakudo-star ×10
raku ×9
perl6 ×8
rakudo ×4
perl ×3
install ×1
msys2 ×1
raspberry-pi ×1
sigils ×1
variables ×1