Recommended CPANの依存モジュールをもう少し正しく検出したい
How to debug a perl script using gdb
PHP と SAPI と ZendEngine3 と
Everyday Life with clojure.spec
Good Parts of PHP and the UNIX Philosophy
『How to build a High Performance PSGI/Plack Server』のその後と ISUCON3を受けての話題
Norikraで作るPHPの例外検知システム YAPC::Asia Tokyo 2015 LT
15分でCakePHPを始める方法(Nseg 2013-11-09 )
omoon.org の裏側 〜FuelPHP の task 活用例〜
awk v.s. bashどっちが強い?@OSC2011Tokyo
More Related Content CPANの依存モジュールをもう少し正しく検出したい
How to debug a perl script using gdb
What's hot (20)
PHP と SAPI と ZendEngine3 と
Everyday Life with clojure.spec
Good Parts of PHP and the UNIX Philosophy
『How to build a High Performance PSGI/Plack Server』のその後と ISUCON3を受けての話題
Norikraで作るPHPの例外検知システム YAPC::Asia Tokyo 2015 LT
15分でCakePHPを始める方法(Nseg 2013-11-09 )
omoon.org の裏側 〜FuelPHP の task 活用例〜
awk v.s. bashどっちが強い?@OSC2011Tokyo
Similar to 2017年夏のPerl (20)
Mojoliciousをウェブ制作現場で使ってみてる
GNU awk (gawk) を用いた Apache ログ解析方法
姫路IT系勉強会 Vol.11 第0回L-1グランプリ bash
Rubyにおける構文追加の試み 〜ボクとRubyと俺々文法〜
More from charsbar (20) Common boolean class_for_perl5
Better detection of what modules are used by some Perl 5 code
2016年のPerl (Long version)
What you need to remember when you upload to CPAN
Analyze CPAN, Analyze Community
CPANTS: Kwalitative website and its tools
2017年夏のPerl6. 正規表現中の { の
扱いが変更に
5.16 で廃止、 5.22 以降警告が出ていたの
が
5.26 では死ぬように
$foo =~ /d{1,10}/; # ok
$foo =~ /d{1}/; # ok
$foo =~ /something{}/; # 5.26 ではエラー
$foo =~ /something[{]/; # ok
$foo =~ /something{/; # ok
$foo =~ /{}/; # これも ok
7. 正規表現中の { の
扱いが変更に
$foo =~ /$hash{bar}/; # ok
$foo =~ /$notahash{}/; # 5.26 ではエラー
$foo =~ /${$foo}/; # ok ( デリファレン
ス )
$foo =~ /${${foo}}/; # ok ( デリファレン
ス )
$foo =~ /$foo/; # ok
$foo =~ /${foo}/; # 5.26 ではエラー
$foo =~ /${[^}]*}/; # ではこれは ???
5.28 で一度警告に戻して仕切り直すことになってい
9. @INC から「 . 」が消え
ました
• inc::Module::Install
• テスト中の t::
• 環境設定用の do "localfile.pl"
• CGI スクリプトの require
"localfile.pl"
などを使っている方は要注意
10. @INC から「 . 」が消え
ました
• まずは CPAN クライアント
と Test::Harness をアップ
デート
• Minilla のようなオーサリン
グツールも
11. @INC から「 . 」が消え
ました
開発環境や CI 環境など、安全性が担
…保できる場合
•完全に移行が済むまでは環境変数
PERL_USE_UNSAFE_INC=1 が楽
( 移行が済んだら =0 に )
•特に大量のテストを抱えている場合
( 素の prove は . を戻してくれませ
12. @INC から「 . 」が消え
ました
• do や require は "./localfile.pl" の
ような書き方で回避できます
• do はファイルがなくても死なない
のでカレントディレクトリに該当
のファイルがあると新たに警告を
出すようになりました
do "localfile.pl" failed, '.' is no longer in @INC;
did you mean do "./localfile.pl"?
13. @INC から「 . 」が消え
ました
• use lib "." や perl -I. はカレント
ディレクトリを最優先させるので
、場合によってはかえって危険
• 迷ったら FindBin を使うか絶対パ
スで
• モジュールの中では @INC をいじ
らない。アプリやスクリプトの起
動時のみで十分
14. 古い Perl 向けの対
策
• 配布するアプリやスクリプトの先
頭でカレントディレクトリを落と
すBEGIN { pop @INC, "." if $INC[-1] eq "" }
• sitecustomize.pl が有効なら、そ
の Perl を使う環境の @INC を調整
可能
20. Unicode 9.0 サポー
トplackup -MEncode -e 'use 5.026; sub {[
200,
["Content-Type" => "text/plain"],
[encode_utf8(
"N{FIRST PLACE MEDAL} ".
"N{TUMBLER GLASS} ".
"N{SNEEZING FACE}"
)],
]}'
http://emojione.com
21. サブルーチンシグネチャ
がまともな速さに
use 5.020;
use experimental "signatures";
use Benchmark qw/cmpthese/;
cmpthese(10000000, {
no_signature => sub { no_sig(1, "value") },
signature => sub { sig(1, "value") },
});
sub no_sig { my ($num, $str) = @_; return "$num $str" }
sub sig ($num, $str) { return "$num $str";}
23. @{^CAPTURE} 特殊変数
my $str = "2017-07-01: YAPC Fukuoka";
$str =~ /A([^:]+): (w+) (w+)/;
say "$1, $2, $3"; # 2017-07-01, YAPC, Fukuoka
my $str = "????-??-??: YAPC ???";
$str =~ /A([^:]+): (w+) (w+)?/;
say "$1, $2, $3"; # ????-??-??, YAPC, ( 警告 )
my $str = "????-??-??: YAPC ???";
my @capture = $str =~ /A([^:]+): (w+) (w+)?/;
say join ", ", @capture; # ????-??-??, YAPC, ( 警
告 )
my $str = "????-??-??: YAPC ???";
$str =~ /A([^:]+): (w+) (w+)?/;
say join ", ", @{^CAPTURE}; # ????-??-??, YAPC
24. %{^CAPTURE} 特殊変数
my $str = "2017-07-01: YAPC Fukuoka";
$str =~ /A
(?<date>[^:]+):s
(?<name>w*)s
(?<city>w*)
/x;
say "$+{date}, $+{name}, $+{city}";
# 2017-07-01, YAPC, Fukuoka
25. %{^CAPTURE} 特殊変数
my $str = "2017-07-01: YAPC Fukuoka";
$str =~ /A
(?<date>[^:]+):s
(?<name>w*)s
(?<city>w*)
/;
say "${^CAPTURE}{date}, ${^CAPTURE}{name},
${^CAPTURE}{city}";
実は特別扱いされていないために 5.26.0 では文字列埋め込
みがおかしな出力に ("{date}, {name}, {city}")
すでにパッチが提供されているので次版で直る見込み
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 の部分だけ
36. 2017.05 からは
perl6 -V がさらに充
実特に CPAN Testers との統合を目指して、 OS
distribution や Kernel 情報なども表示されるようになっ
ています$ perl6 -V
distro::auth=http://www.debian.org/
distro::desc=2017-06-29T03:22:49.796661+09:00
distro::is-win=False
distro::name=debian
...
kernel::archname=x86_64-linux
kernel::name=linux
kernel::version=3.16.0.4.amd.64
...
38. パフォーマンスや
安定性も着実に向上
Jonathan Worthington 氏が
2 期目の作業を完了しまし
た
(3 期目の助成金も申請中 )- http://news.perlfoundation.org/2017/04/perl-6-performance-and-reliabi-3.html
- https://6guts.wordpress.com/2017/06/08/sorting-out-synchronous-io/
39. Perl 6 の「安定
性」 ?
• テストがないものは実装があっても
「仕様」ではありません
• 疑問に思ったら設計文書ではなく公式
仕様テスト (ROAST) をご確認ください
• 互換性が壊れるような仕様変更につい
ては ( 開発版には先行実装が含まれる
かもしれませんが ) 正式には次のバー
ジョンに持ち越されます
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)
41. IOwesomeness
Zoffix Znet 氏が I/O まわりの作業を完了しまし
た
• 実装しかなかった I/O 関係のコードすべ
てにテストとドキュメントが用意されま
した
• 仕様に含めない決定が下されたコードは
( 6.d で)削除されることになります
• パフォーマンスも改善されました
http://blogs.perl.org/users/zoffix_znet/2017/05/completion-
report-perl-6-io-tpf-grant.html
43. Unicode サポート
say 「こんにちはこんにちは」 ; # 半角「 」のみ
my $ 税率 = 1.08; ($ 金額 ×$ 税率 ).say;
say 100² ÷ ⅕; # 50000;
# say 100 ** 2 / unival("x[2155]");
say "in-between" if 10 ≦ $num ≦ 1000;
say 「こんにちはこんにちは」 ; # 半角「 」のみ
my $ 税率 = 1.08; ($ 金額 ×$ 税率 ).say;
say 100² ÷ ⅕; # 50000;
# say 100 ** 2 / unival("x[2155]");
say "in-between" if 10 ≦ $num ≦ 1000;
44. Unicode サポート
見かけ上 1 文字に見えてしまう肌色修飾子なども正しく扱えます
$ perl5 -E 'say length "N{MAN}N{EMOJI MODIFIER FITZPATRICK TYPE-5}"' # 2
$ perl6 -e 'say "c[MAN]c[EMOJI MODIFIER FITZPATRICK TYPE-5]".chars' # 1
$ perl6 -e 'say "c[MAN]c[EMOJI MODIFIER FITZPATRICK TYPE-5]".codes' # 2
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
50. Perl 6 のモジュールを書
く
とりあえず何か書いてみたいという
方は
skaji さんの App::Mi6 を
# panda は正式に開発終了になりました
$ zef install App::Mi6
===> Searching for: App::Mi6
===> Updated cpan mirror: https://raw.githubusercontent.com/ugexe/Perl6-
ecosystems/master/cpan.json
===> Updated p6c mirror: http://ecosystem-api.p6c.org/projects.json
$ mi6 new Your::Perl6::Module
51. 書き上がったモジュールは
CPAN へ
5 月に開催された Perl Toolchain Summit
で Perl 6 のディストリビューションもそ
のまま PAUSE にアップロードできるよう
になりました
• 内部的には作者の Perl6 ディレクトリに移動
• App::Mi6 を最新にすれば CPAN へのアップ
ロードも可能に
$ mi6 dist
$ mi6 upload
52. 書き上がったモジュールは
CPAN へ
最新の zef は CPAN のモジュールも認識し
ます
$ zef list --max=100
...
===> Found via Zef::Repository::Ecosystems<cpan>
Inline:ver('1.2.1')
Inline:ver('1.2')
Inline:ver('1')
IO::Glob:ver('0.1'):auth('github:zostay')
Text::CSV:ver('0.007'):auth('github:Tux')
Text::CSV:ver('0.008'):auth('github:Tux')
Data::Selector:ver('1.01')
Data::Selector:ver('1.02')
NativeCall:ver('1')
...
53. 6.d.PREVIEW
• Rakudo 2017.02 からは最初の 6.c 非互
換機能となる nonblocking await の実装
が入っています
• 試す場合は use v6.d.PREVIEW; で
https://github.com/perl6/roast/blob/master/S17-supply/syntax-nonblocking-await.t
54. これから学ぶなら
当面はググるよりも信頼できる情報源を頼るの
が吉
•Perl 6 の各種アドベントカレンダー
– https://perl6advent.wordpress.com/
roast/integration/ 以下のテストも参照
– http://qiita.com/advent-calendar/2016/perl6
– http://qiita.com/advent-calendar/2015/perl6
•Perl 6 入門 : http://ja.perl6intro.com
•RosettaCode
https://rosettacode.org/wiki/Category:Perl_6
•公式テスト
•perl6.org
56. 6.c 対応の書籍も続々
と書かれています
• Perl 6 at a Glance (Andrew Shitov; 2017.01.01)
https://deeptext.media/perl6-at-a-glance/ ( 電子書籍版も出ました )
• Think Perl 6
(Laurent Rosenfeld, Allen B. Downey; 2017.05.25)
http://shop.oreilly.com/product/0636920065883.do
• Migrating to Perl 6 (Andrew Shitov)
https://deeptext.media/migrating-to-perl6
• Learning Perl 6 (brian d foy)
https://www.learningperl6.com
57. 6.c 対応の書籍も続々
と書かれています
• Perl 6 Fundamentals (Moritz Lenz)
http://www.apress.com/us/book/9781484228982
• Searching and Parsing with Perl 6 Regexes (Moritz Lenz)
https://leanpub.com/perl6regex
• Web Application Development in Perl 6 (Gabor Szabo)
• Using Perl 6 (Andrew Shitov)
• Perl 6 Deep Dive (Andrew Shitov)
58. その他の情報源
• Weekly changes in and around Perl 6
https://p6weekly.wordpress.com
• https://twitter.com/perl6org
• Youtube の Perl 6 関連ビデオ
http://bit.ly/perl6_english_video
• 次期バージョンについて
– https://github.com/perl6/specs/blob/master/v6d.pod
– https://github.com/rakudo/rakudo/blob/nom/docs/language_versions.md
• WEB+DB PRESS Vol.93 「 Perl 6 の歩き方」
http://gihyo.jp/dev/serial/01/perl-hackers-hub/003901
59. 2017 年後半の主要
Perl 関連イベント
The Perl Conferences (YAPC)
•2017.06.18-23 (Alexandria, Virginia, USA) ( 終了 )
•2017.08.09-11 (Amsterdam, Netherlands)
Swiss Perl Workshop 2017
•2017.08.25-26 (Villars-sur-Ollon, Switzerland)
London Perl Workshop 2017
•2017.11.25 (London, UK)