12. @INC から「 . 」が消え
ました
• do や require は "./localfile.pl" の
ような書き方で回避できます
• do はファイルがなくても死なない
のでカレントディレクトリに該当
のファイルがあると新たに警告を
出すようになりました
do "localfile.pl" failed, '.' is no longer in @INC;
did you mean do "./localfile.pl"?
17. レキシカルサブルーチン
が正式化
万能ではないです
× my sub Test::More::ok { ... }
○ local *Test::More::ok = sub { ... };
use Test::More;
{
ok ...; # 先に出てきたものは当然ながら元のま
ま
my sub ok { ... }
}
34. 「ロースト」のお味、試
してみましたか?
• Perl 6 では実装と仕様が明確に分
かれています
• ラリーが「クリスマス」に持って
きてくれたのは「公式テスト
(Repository Of All Spec Tests) 」の
クリスマス・バージョンです
35. $ perl6 -v
This is Rakudo version 2017.06 built on
MoarVM version 2017.06
implementing Perl 6.c.
• say $*PERL.version; # v6.c
• say $*PERL.name; # Perl 6
• say $*PERL.compiler.version; # v2017.06
• say $*PERL.compiler.name; # rakudo
• say $*VM.version; # v2017.06
• say $*VM.name; # moar
use 文で制御できるのは v6.c の部分だけ
40. 中には特定の環境にしか公式テス
トが存在しないものがあります
given $*DISTRO.name {
when "macosx" {
#?rakudo.jvm 3 skip "file system events NYI? RT #124828"
subtest &macosx, "does watch-path work on Mac OS X";
unlink $filename; # in case we missed the cleanup
ok !$filename.IO.e, "make sure we don't have a file (2)";
subtest { macosx :io-path }, "does IO::Path.watch work on
Mac OS X";
}
default {
skip "Only OSX tests available", 3;
}
}
perl6/roast/S17-supply/watch-path.t
(for IO::Notification.watch-path)
45. 親切なエラーメッセー
ジPerl 5 ユーザがやらかしがちなミスは実行
時に正しい書き方を教えてくれます
$ perl5 -E 'say length "N{MAN}N{EMOJI MODIFIER FITZPATRICK TYPE-5}"'
$ perl6 -e 'say length "N{MAN}N{EMOJI MODIFIER FITZPATRICK TYPE-5}"'
# Unsupported use of N{CHARNAME}; in Perl 6 please use c[CHARNAME]
$ perl6 -e 'say length "c[MAN]c[EMOJI MODIFIER FITZPATRICK TYPE-5]"'
# Undeclared routine:
# length used at line 1. Did you mean 'elems', 'chars', 'graphs', 'codes'?
46. 親切なエラーメッセー
ジ
2017.05 からは Perl 5 とは無関係な
ミスも教えてくれるようになりまし
た
$ perl6 -e 'say 42.195.Inf'
No such method 'Inf' for invocant of type 'Rat'.
Did you mean 'Int'?
47. perl6-js
ついに誰でもコンパイルが可能になりま
した (Node.js 7.x が必要 )
$ git clone https://github.com/rakudo/rakudo.git rakudo-js
$ cd rakudo-js
$ git checkout js
$ perl Configure.pl --backends=moar,js --gen-nqp --gen-moar
$ make js-all
$ ./perl6-js -v
This is Rakudo version 2017.06-223-g85a481c built on JS
implementing Perl 6.c.
$ ./perl6-js -e 'say(123)'
$ make js-spectest
http://blogs.perl.org/users/pawel_murias/2017/06/rakudojs-update---
build-sanely-and-passes-some-spec-tests.html