Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
2018年残暑のPerl
Search
Kenichi Ishigaki
August 26, 2018
Technology
0
1.4k
2018年残暑のPerl
Learn Language 2018 in ODC
Kenichi Ishigaki
August 26, 2018
Tweet
Share
More Decks by Kenichi Ishigaki
See All by Kenichi Ishigaki
2025年秋のPerl
charsbar
2
460
2024年秋のPerl
charsbar
1
1.8k
perl_in_2024winter.pdf
charsbar
0
60
perl_in_2023spring.pdf
charsbar
1
570
Parsing a distribution name is sometimes hard
charsbar
0
120
Recent PAUSE Changes
charsbar
0
150
perl_2019_winter
charsbar
1
1.9k
Other Decks in Technology
See All in Technology
計算機科学をRubyと歩む 〜DFA型正規表現エンジンをつくる~
ydah
3
200
AWS CLIの新しい認証情報設定方法aws loginコマンドの実態
wkm2
5
540
技術以外の世界に『越境』しエンジニアとして進化を遂げる 〜Kotlinへの愛とDevHRとしての挑戦を添えて〜
subroh0508
1
390
小さな判断で育つ、大きな意思決定力 / 20251204 Takahiro Kinjo
shift_evolve
PRO
1
580
re:Invent 2025 ~何をする者であり、どこへいくのか~
tetutetu214
0
110
Playwrightのソースコードに見る、自動テストを自動で書く技術
yusukeiwaki
13
4.9k
チーリンについて
hirotomotaguchi
3
930
Sansanが実践する Platform EngineeringとSREの協創
sansantech
PRO
2
660
意外とあった SQL Server 関連アップデート + Database Savings Plans
stknohg
PRO
0
290
A Compass of Thought: Guiding the Future of Test Automation ( #jassttokai25 , #jassttokai )
teyamagu
PRO
1
250
re:Invent 2025 ふりかえり 生成AI版
takaakikakei
1
180
GitHub Copilotを使いこなす 実例に学ぶAIコーディング活用術
74th
3
1.6k
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
The Language of Interfaces
destraynor
162
25k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
The World Runs on Bad Software
bkeepers
PRO
72
12k
What's in a price? How to price your products and services
michaelherold
246
12k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.8k
A designer walks into a library…
pauljervisheath
210
24k
Visualization
eitanlees
150
16k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Six Lessons from altMBA
skipperchong
29
4.1k
Transcript
2018年残暑のPerl Kenichi Ishigaki @charsbar Learn Language 2018 in ODC Aug
26, 2018
me • 2016年のPerl@LLoT • Perl in 2016@YAPC::Hokkaido • 2017年春のPerl@YAPC::Kansai •
2017年夏のPerl@YAPC::Fukuoka • (2018年初夏のPerl5)@Hokkaido.pm #14 • 2018年夏のPerl5@Shibuya.pm #18 • 2018年残暑のPerl@LL2018 <- イマココ
Perl 5.26/5.28が 出ています • https://metacpan.org/release/XSAWYERX/perl-5.26.0/ • https://metacpan.org/release/XSAWYERX/perl-5.28.0/
おもな変更点は perldelta参照 • https://metacpan.org/pod/release/XSAWYERX/perl-5.26.0/pod/perldelta.pod • https://metacpan.org/pod/release/XSAWYERX/perl-5.28.0/pod/perldelta.pod ※基本的に細かい修正ばかりです
ヒアドキュメントがインデント可能に (5.26) { my ($key, $value) = qw/foo bar/; my
$json_template = << "END"; {"$key": "$value"} END } { my ($key, $value) = qw/foo bar/; my $json_template = <<~ "END"; {"$key": "$value"} END }
異なる種類のハンドルの共有は エラーに (5.28) # 5.26まで open my $hd, '<', 'foo.txt';
opendir $hd, 'bar/'; say <$hd>; # foo.txtの中身を出力 say readdir $hd; # barディレクトリのファイル一覧 # 5.28 Cannot open $hd as a dirhandle: it is already open as a filehandle
文字列用のビット演算子 (5.28) • 5.22で実験的に導入されたものが昇格 # 5.26まで use utf8; say "生"
& "死"; # 愛 # 5.28 use utf8; say "生" & "死"; # 0 say "生" &. "死"; # 愛
影響の大きな変更
@INCからカレントディレクトリが 除去 (5.26) • 数年越しのセキュリティフィックス • 古いCGIスクリプトなどは動かなくなるかも • まずはツールチェーンのアップデートを •
requireなどは起点のパスを追加 • 必要なら@INCの末尾に"."を戻す #!/usr/bin/perl require "jcode.pl"; do "main.pl"; #!/usr/bin/perl require "./jcode.pl"; do "./main.pl";
encodingプラグマの変更 (5.26) × use encoding 'cp932'; ◦ use encoding 'cp932',
Filter => 1; • 日本語Windows環境で5C問題にわずらわ されずに小物スクリプトを書くときには便利 だったのですが…
Test2フレームワークの 導入 (5.26) • Test::Builderの中身が新しいTest2 フレームワークに • 一部のテストモジュールが未対応
仕切り直しになったもの
正規表現中のあいまいな { の扱い (5.26) • 5.16で廃止、5.22で警告、5.26でエラーに • CPANのみならずgolangのテストなどにも影響 • autoconfで問題発覚。該当の表現のみ警告に
$foo =~ /¥d{1,10}/; # ok $foo =~ /something{}/; # 5.26ではエラー $foo =~ /something[{]/; # ok $foo =~ /something¥{/; # ok $foo =~ /{}/; # これもok $foo =~ /$hash{bar}/; # ok $foo =~ /$hashlike{}/; # 5.26ではエラー $foo =~ /¥$foo/; # ok $foo =~ /¥${foo}/; # 5.26ではエラー $foo =~ /¥${[^¥}]*}/'; # autoconf問題
正規表現中のあいまいな { の扱い (5.28) • 一部はふたたび警告に $foo =~ /something{}/; $foo
=~ /¥${foo}/; # 5.28から警告、5.32でエラーになる予定 $foo =~ /({1})/; $foo =~ /¥({1}¥)/; # これはOK
スマートマッチ問題 (5.28) • 5.10で正式な機能として導入(Perl 6由来) • さまざまな問題を経て5.18で実験的機能に格下げ • 5.27.7 (2017-12-20リリース)で大きな仕様変更
• CPANへの影響大のため5.27.8で差し戻しに P5P update: Smarter Match https://www.perl.com/article/p5p-update-smarter-match/
サブルーチンシグネチャの 再修正 (5.28) • 5.20で実験的に導入 • 5.22でシグネチャとアトリビュートの並び順が変更に • 高速化も進み、シグネチャなしの場合とほぼ同等に •
:lvalueの場合に問題が発覚したため、再度仕様変更 (lvalue: $obj->setter = "value"; のような構文) sub f :lvalue ($a, $b) { ... }; # 5.20 sub f ($a, $b) :lvalue { ... }; # 5.22~5.26 sub f :lvalue ($a, $b) { ... }; # 5.28~
いろいろと議論は ありました • Perl 5 Core Hackathon (2016年~) • 廃止予定のロードマップ作成
(5.26) • 実装予定のロードマップ? • 継続的テストの対象拡大? • 理想と現実
CPAN Meta DBの統計によると… • 公式サポートバージョンは 3割程度 2018年08月25日時点で サンプル数が最大なのは 5.16.3 (15.7%)
• CentOS 5の退役で5.8.8 が1%以下に • あくまで参考程度に http://cpanmetadb.plackperl.org/versions/?date=20180825
話題のCPAN モジュール
PPR (2017) • Damian Conway氏作 • Pattern-based Perl Recognizer •
正規表現でPerlコードをパース • 5.10で追加された(DEFINE)を活用 use PPR; # $source_codeがPerlとして正しく解析できるか確認 if ($source_code =~ m{¥A (?&PerlDocument) ¥Z $PPR::GRAMMAR}x) { ... } else { say "¥$source_codeに構文エラーがあります"; }
PPR (2017) our $GRAMMAR = qr{ (?(DEFINE) (?<PerlDocument> ¥x{FEFF}?+ #
Optional BOM marker (?&PerlStatementSequence) ) # End of rule (?<PerlStatementSequence> (?&PerlPodSequence)?+ (?: (?&PerlStatement) (?&PerlPodSequence)?+ )*+ ) # End of rule ... (こんな感じの定義が約1750行) }xms;
Babble (2018) • Matt S Trout氏作 • JavaScriptのBabelインスパイア • PPRを活用して最近のコードを古い
Perl向けのコードに置換 • サブルーチンシグネチャの新旧切り 替えにも対応 • .pmcという拡張子のファイルを活用 すると新旧両用にも
構文拡張系のモジュール • 5.12/5.14で追加されたキーワード プラグイン/構文解析機構を利用 • スコープの扱いなどがより直感的に • Syntax::Keyword::Try • Future::AsyncAwait
• Function::Parameters など
DBD::MariaDB (2018) • 従来のDBD::mysqlからのフォーク • 最新のMySQL/MariaDBをサポート • セキュリティ問題など修正多数 • Unicodeまわりの扱いが従来の
DBD::mysqlとは異なるため、既存ア プリの移行は慎重に
Perl 6について • 月々のリリースは続いています • 次のメジャーリリースとなる6.dが準備中 (予定では2018年11月のDiwali祭後に) • 書籍も続々と •
最近ではCroというウェブアプリケーション フレームワークが話題 • IntelliJを利用したCommaというPerl 6用 IDEも登場(Early Beta)
Questions?
Thank you