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
NilAway による静的解析で「10 億ドル」を節約する #kyotogo / Kyoto Go 56th
ytaka23
3
380
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
120
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
13
3.7k
TSKaigi 2024 の登壇から広がったコミュニティ活動について
tsukuha
0
160
2024年にチャレンジしたことを振り返るぞ
mitchan
0
140
新機能VPCリソースエンドポイント機能検証から得られた考察
duelist2020jp
0
220
MLOps の現場から
asei
6
640
Snowflake女子会#3 Snowpipeの良さを5分で語るよ
lana2548
0
230
統計データで2024年の クラウド・インフラ動向を眺める
ysknsid25
2
840
コンテナセキュリティのためのLandlock入門
nullpo_head
2
320
.NET 9 のパフォーマンス改善
nenonaninu
0
900
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
160
Featured
See All Featured
Producing Creativity
orderedlist
PRO
341
39k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
A better future with KSS
kneath
238
17k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
What's in a price? How to price your products and services
michaelherold
243
12k
Speed Design
sergeychernyshev
25
670
Code Review Best Practice
trishagee
65
17k
How to Ace a Technical Interview
jacobian
276
23k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
520
Embracing the Ebb and Flow
colly
84
4.5k
Become a Pro
speakerdeck
PRO
26
5k
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·͞ʹͦΕΛ࣮͍ͯ͠Δɻ