Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PPRとKeyword::Simpleと あとVariable::Declaration
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Kenta Kobayashi
March 03, 2018
Technology
230
0
Share
PPRとKeyword::Simpleと あとVariable::Declaration
Kenta Kobayashi
March 03, 2018
More Decks by Kenta Kobayashi
See All by Kenta Kobayashi
Perlの生きのこり - YAPC::Fukuoka 2025
kfly8
0
2.1k
プロジェクトの空気を読んで開発してくれるPerlのAIツールがほしい
kfly8
2
910
Perlの生きのこり - エンジニアがこの先生きのこるためのカンファレンス2025
kfly8
4
3.1k
Tシャツに書かれたコードを読む
kfly8
0
1.5k
Introduce Sub::Meta
kfly8
0
100
研修はイベントでなくコミュニティ作り
kfly8
0
2.3k
明日からできる新人のオンボーディングガイド
kfly8
0
900
メンター成長のためのふりかえり会
kfly8
0
1.4k
Interfaces in Perl5 at The Perl Conference 2019 in Pittsburgh
kfly8
0
3.3k
Other Decks in Technology
See All in Technology
AI Engineering Summit Tokyo 2026 AIの前に、やることがある 〜医療データ企業の4フェーズ〜
dtaniwaki
0
1.4k
MIERUNE JCT 発表資料「宇宙から伊能忠敬ごっこ」
syuchimu
0
130
AI-DLCを活用した高品質・安全なAI駆動開発実践 / AI Driven Development
yoshidashingo
1
330
Mastering Ruby Box
tagomoris
3
140
電子辞書Brainをネットに繋げてみた(自力編)
raspython3
0
430
AI Adaptable なテストを整える工夫 / Ways to Make Your Tests AI-Adaptable
bitkey
PRO
2
210
美味しいスイスチーズを作ろう🧀🐭
taigamikami
1
230
「嘘をつくテスト」の失敗例から学ぶ 良いテストコード #frontend_phpcon_do
asumikam
0
160
個人AIからチームAIへ:開発における品質と生産性の再設計
moongift
PRO
0
370
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.8k
AIを「創る」と「使う」の循環 — HRテックが実践するリアルなAI組織実装
taketo957
0
1.1k
APIテストとは?
nagix
0
170
Featured
See All Featured
Ruling the World: When Life Gets Gamed
codingconduct
0
240
YesSQL, Process and Tooling at Scale
rocio
174
15k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
250
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
240
Making Projects Easy
brettharned
120
6.7k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
71
40k
Designing Powerful Visuals for Engaging Learning
tmiket
1
390
Done Done
chrislema
186
16k
WCS-LA-2024
lcolladotor
0
610
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
600
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Transcript
PPR と Keyword::Simple と あと Variable::Declaration YAPC::Okinawa 2018 / LT
@k y8
k y8 2 歳の娘の父になった モバファク JPA
agenda 1. PPR 2. Keyword::Simple 3. Variable::Declaration
PPR
PPR Perl の静的解析モジュー ル 類似モジュー ルは、PPI 正規表現を使った、 解析ができる Statement,Variable,Block,etc
PPR example use PPR; my $s = 'my $yapc:OKINAWA =
"OIST"'; print $s =~ m{ ((?&PerlAttributes)) $PPR::GRAMMAR }x; # => :OKINAWA
PPR pros/cons 意図はわかりやすく、 簡潔 意図通りに作るのが難しい( 主観) Perl が柔軟すぎて
Keyword::Simple
Keyword::Simple Pure Perl で Perl にキー ワー ド追加できる PL_keyword_plugin を利用
類似モジュー ル Devel::Declare Keyword::Declare
Keyword::Simple example package ExampleKeywordSimple; use Keyword::Simple; sub import { Keyword::Simple::define
'yapc' => sub { my $ref = shift; substr($$ref, 0, 0) = 'print " はいさい!";sub'; }; } 1; use ExampleKeywordSimple; yapc okinawa { } # => はいさい!
Keyword::Simple pros/cons Pure Perl で Perl を弄れる(2 回目) B::Deparse が手放せない(
主観) use ExampleKeywordSimple; BEGIN { $^H{'Keyword::Simple/keywords'} = 'HASH(0x7fc1b940a018)' } ; ; print " はいさい!"; sub okinawa { BEGIN { $^H{'Keyword::Simple/keywords'} = 'HASH(0x7fc1b940a018)' } }
PPR × Keyword::Simple Pure Perl で Perl を静的解析した結果を用いて Perl を拡張できる
Variable::Declaration
Variable::Declaration PPR × Keyword::Simple 変数宣言の拡張 use Type::Tie use Data::Lock
Variable::Declaration example use Variable::Declaration; use Types::Standard qw/Int/; let Int $foo
= 2018; $foo = 'YAPC'; # ERROR: Value "YAPC" did not pass type constraint "Int"
deparse example use Variable::Declaration; use Types::Standard ('Int'); use feature 'state';
BEGIN { $^H{'Keyword::Simple/keywords'} = 'HASH(0x7fc8de02e350)' } ; ; my $foo = 2018; croak(Int->get_message($foo)) unless Int->check($foo); ttie $foo, Int; $foo = 'YAPC';
Variable::Declaration pros/cons buggy ( v0.01 ) 静的型付き言語を使えば? と言われる
Thanks!!