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
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
1.3k
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
290
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
Lexical Analysis
shigashiyama
1
150
SRE×AIOpsを始めよう!GuardDutyによるお手軽脅威検出
amixedcolor
0
140
これまでの計測・開発・デプロイ方法全部見せます! / Findy ISUCON 2024-11-14
tohutohu
3
370
Introduction to Works of ML Engineer in LY Corporation
lycorp_recruit_jp
0
130
OCI Security サービス 概要
oracle4engineer
PRO
0
6.5k
AWS Media Services 最新サービスアップデート 2024
eijikominami
0
200
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
160
SREが投資するAIOps ~ペアーズにおけるLLM for Developerへの取り組み~
takumiogawa
1
380
Featured
See All Featured
Practical Orchestrator
shlominoach
186
10k
Site-Speed That Sticks
csswizardry
0
27
A Tale of Four Properties
chriscoyier
156
23k
Done Done
chrislema
181
16k
Teambox: Starting and Learning
jrom
133
8.8k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
A better future with KSS
kneath
238
17k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
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·͞ʹͦΕΛ࣮͍ͯ͠Δɻ