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
2.5k
昔のGo, 今のGo ~比較, ソート編~
skaji
0
170
Perl Quiz
skaji
0
130
cpm at PerlCon 2019
skaji
0
110
Internal of cpm
skaji
0
570
How to execute external programs in Perl
skaji
3
570
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
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
3.9k
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
130
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
130
Lambdaと地方とコミュニティ
miu_crescent
2
370
Amplify Gen2 Deep Dive / バックエンドの型をいかにしてフロントエンドへ伝えるか #TSKaigi #TSKaigiKansai #AWSAmplifyJP
tacck
PRO
0
390
組織成長を加速させるオンボーディングの取り組み
sudoakiy
2
210
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
110
安心してください、日本語使えますよ―Ubuntu日本語Remix提供休止に寄せて― 2024-11-17
nobutomurata
1
1k
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.7k
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
Zennのパフォーマンスモニタリングでやっていること
ryosukeigarashi
0
150
DynamoDB でスロットリングが発生したとき/when_throttling_occurs_in_dynamodb_short
emiki
0
260
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
A better future with KSS
kneath
238
17k
BBQ
matthewcrist
85
9.3k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Site-Speed That Sticks
csswizardry
0
28
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Code Reviewing Like a Champion
maltzj
520
39k
A Tale of Four Properties
chriscoyier
156
23k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Designing Experiences People Love
moore
138
23k
Why Our Code Smells
bkeepers
PRO
334
57k
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·͞ʹͦΕΛ࣮͍ͯ͠Δɻ