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
Perl5 Package Manager
Search
Shoichi Kaji
August 26, 2018
Technology
0
660
Perl5 Package Manager
Learn Languages 2018 in ODC (LL2018), 2018/08/26
Shoichi Kaji
August 26, 2018
Tweet
Share
More Decks by Shoichi Kaji
See All by Shoichi Kaji
宿泊予約サイトにおける検索と料金計算の両立
skaji
2
3.6k
昔のGo, 今のGo ~比較, ソート編~
skaji
0
180
Perl Quiz
skaji
0
130
cpm at PerlCon 2019
skaji
0
110
Internal of cpm
skaji
0
580
How to execute external programs in Perl
skaji
3
580
Writing Perl with w0rp/ale
skaji
0
2.2k
nginx unit
skaji
0
44
Perl6 ecosystem
skaji
1
1.4k
Other Decks in Technology
See All in Technology
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
190
ハイテク休憩
sat
PRO
2
160
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
160
権威ドキュメントで振り返る2024 #年忘れセキュリティ2024
hirotomotaguchi
2
750
LINEスキマニにおけるフロントエンド開発
lycorptech_jp
PRO
0
330
Oracle Cloudの生成AIサービスって実際どこまで使えるの? エンジニア目線で試してみた
minorun365
PRO
4
280
NilAway による静的解析で「10 億ドル」を節約する #kyotogo / Kyoto Go 56th
ytaka23
3
380
10個のフィルタをAXI4-Streamでつなげてみた
marsee101
0
170
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
37
14k
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
110
統計データで2024年の クラウド・インフラ動向を眺める
ysknsid25
2
850
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
200
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
53
13k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Facilitating Awesome Meetings
lara
50
6.1k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Raft: Consensus for Rubyists
vanstee
137
6.7k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
98
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Transcript
Perl5ͷ ύοέʔδϚωʔδϟ Shoichi Kaji
Me • Shoichi Kaji • CPAN, github: skaji • the
author of cpm (a Perl5 module installer)
͜ͷൃදͷత • Perl5Λීஈ͋·Γ৮͍ͬͯͳ͍ਓΛରʹ • ࠓޙɺPerl5Λ৮Ζ͏ͱͨ͠ͱ͖ͷͨΊʹ • moduleͷΠϯετʔϧཧͷΓํΛ ఏࣔ͢Δ
Contents • moduleͷΠϯετʔϧ - cpanm • ґଘmoduleͷએݴ - cpanfile •
ґଘmoduleͷversionอଘɺ࠶ݱ - carton • ·ͱΊ • ࠓޙͷಈ͖
moduleͷΠϯετʔϧ › perl monitor.pl Can't locate Capture/Tiny.pm in @INC (you
may need to install the Capture::Tiny module)… ͨͱ͑Perl5Ͱॻ͔ΕͨࢹεΫϦϓτmonitor.pl͕ ͋Δͱ͢ΔɻͦΕΛ࣮ߦ͢Δͱ... Capture::Tiny͕ೖͬͯͳ͍
moduleͷΠϯετʔϧ moduleͷΠϯετʔϧʹcpanmΛ͏ cpanmࣗͷΠϯετʔϧํ๏ # case1. globalʹೖΕΔ › curl https://cpanmin.us |
perl - -n App::cpanminus # ͠perl͕system perlͷ߹ɺͪΖΜsudo͕ඞཁ › curl https://cpanmin.us | perl - -n --sudo App::cpanminus # case2. ڥΛԚͨ͘͠ͳ͍߹ΧϨϯτσΟϨΫτϦʹऔͬͯ͘ΕΑ͍ › curl -o cpanm https://cpanmin.us › perl ./cpanm --version
moduleͷΠϯετʔϧ # Capture::TinyΛΠϯετʔϧ › cpanm -n Capture::Tiny Successfully installed Capture-Tiny-0.48
› perl monitor.pl # WORkS!
moduleͷΠϯετʔϧ # σϑΥϧτͰ୯ମςετΛΒ͔ͤͯΒΠϯετʔϧ͢Δ # -n ͰͦΕΛεΩοϓͰ͖Δ › cpanm -n Amon2
# σϑΥϧτͰɺglobalͳσΟϨΫτϦʹmoduleΛΠϯετʔϧ͢Δ # ڥΛԚͨ͘͠ͳ͍߹ɺ-L ΛͬͯΠϯετʔϧઌΛมߋ͢Δ › cpanm -L ./local Mojolicious # ࣮ߦ࣌ -I ͰͦͷσΟϨΫτϦΛsearch pathʹՃ͢Δ › perl -I ./local/lib/perl5 script.pl ͍͔ͭ͘ͷcpanmͷtips
ґଘmoduleͷએݴ • ࣗͰPerl5ͷεΫϦϓτΛॻ͍ͨͱ͠Α͏ • ͍͔ͭ͘ґଘmodule͕͋Δ͚ΕͲɺ ͦΕΛͲ͏Ϣʔβʹ͑Ε͍͍ͷ͔ • cpanfileΛ͓͏
ґଘmoduleͷએݴ cpanfile - ґଘmoduleΛએݴ͢ΔϑΝΠϧ › cat cpanfile requires 'Plack', '1.0';
# 1.0 or newer requires 'JSON', '>= 2.00, < 2.80'; # ୯ମςετ࣌ͷΈඞཁͳmodule on test => sub { requires 'Test::More', '== 1.302140'; recommends 'Test::TCP', '1.12'; };
ґଘmoduleͷએݴ # cpanfile͕͋ΔσΟϨΫτϦͰcpanmΛ--installdepsͱͱʹ # ࣮ߦ͢ΕґଘmoduleΛΠϯετʔϧͰ͖Δ › capnm -n --installdeps .
# -L ͱΈ߹ΘͤΕɺΧϨϯτσΟϨΫτϦʹ # ґଘmoduleΛΠϯετʔϧͰ͖Δ › cpanm -n -L ./local --installdeps . › perl -I ./local/lib/perl5 script.pl cpanfileʹґଘmoduleΛએݴ͢Ε cpanmͰ؆୯ʹΠϯετʔϧͰ͖Δ
ґଘmoduleͷversionอଘɺ࠶ݱ • Perl5ͰຊࠊΛೖΕͯΞϓϦέʔγϣϯΛॻ͍͍ͯ͘ ͱɺґଘmodule͙͢ʹ100Λ͑Δ • ͢Δͱґଘmoduleͷversionʹහײʹͳͬͯ͘Δ • ։ൃڥͰςετΛpassͨ͠ͱ͖ͷґଘmoduleͷ versionΛͯ͢อଘ͠ɺͦΕΛຊ൪Ͱ࠶ݱ͍ͨ͠ •
cartonΛ͓͏
ґଘmoduleͷversionอଘɺ࠶ݱ # CartonࣗͷΠϯετʔϧ › cpanm -n Carton # cpanfileͰએݴ͞ΕͨґଘmoduleΛ./localʹΠϯετʔϧ͢Δ ›
carton install Complete! Modules were installed into …/local # Πϯετʔϧͨ͠moduleͷversioncpanfile.snapshotʹอଘ͞ΕΔ › ls cpanfile cpanfile.snapshot local # carton execͰ./localΛsearch pathʹೖΕͯperlΛىಈͰ͖Δ # (ͪΖΜɺcarton execΛΘͣࣗͰ-IΛࢦఆͯ͠Α͍) › carton exec perl script.pl cartonΛ༻͍ͨ։ൃϑϩʔ(1)
ґଘmoduleͷversionอଘɺ࠶ݱ # ͦͷޙɺผͷڥͰ--deploymentΛ͚ͭͯΠϯετʔϧ͢Δ͜ͱͰ # snapshotʹهड़͞ΕͨversionΛ࠶ݱͰ͖Δ › carton install --deployment Installing
modules using …/cpanfile (deployment mode) Complete! Modules were installed into …/local cartonΛ༻͍ͨ։ൃϑϩʔ(2)
·ͱΊ • moduleͷΠϯετʔϧʹcpanmΛ͏ • ґଘmoduleͷએݴʹcpanfileΛ͏ • ґଘmoduleͷversionอଘɺ࠶ݱʹ cartonΛ͏
ࠓޙͷಈ͖ (πʔϧ) • moduleΠϯετʔϥͱͯ͠cpanmҎ֎ʹ CPAN.pm, CPANPLUS, cpmͳͲ͕͋Δ • cartonͷޙܧͱͯ͠carmel͕։ൃ͞Ε͍ͯΔ
ࠓޙͷಈ͖ (Έ) • Perl5ͰGNU Autotoolsͱಉ͡Α͏ʹϢʔβαΠυͰεΫϦϓτΛ࣮ߦͤ͞ɺΠ ϯετʔϧ࣌ͷڍಈΛಈతʹมԽͤ͞Δͷ͕ৗͰ͋ͬͨɻ Ұํɺେͷ߹͜ΕoverkillͰ͋Γɺ੩తղੳͱ૬ੑ͕ѱ͍ɻ ͜Εʹର͠ɺࡢࠓɺͬͱγϯϓϧͳstatic installͱ͍͏ΠϯετʔϧͷΈ͕ ఏҊ͞Ε͍ͯΔɻ
• Perl5Ͱී௨ɺͯ͢ͷmoduleͨͪΛ͋ΔҰͭͷσΟϨΫτϦʹ·ͱΊͯΠϯ ετʔϧ͍ͯ͠Δɻ ͔͠͠ɺͦ͏ͯ͠͠·͏ͱɺͲͷmodule͕Ͳͷdistributionʹଐ͢Δͷ͔Θ͔Β ͳ͘ͳΓɺཧ͕͠ʹ͘͘ͳΔɻ ͜Εʹର͠ɺʮdistribuitonΛผʑʹཧ͠ɺ࣮ߦ࣌ʹͦΕΒΛదʹsearch pathʹஔ͠Α͏ʯͱ͍͏ΞΠσΞ͕͋Γ carmel·͞ʹͦΕΛ࣮͍ͯ͠Δɻ