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
650
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
1.6k
昔のGo, 今のGo ~比較, ソート編~
skaji
0
150
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
560
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
CAMERA-Suite: 広告文生成のための評価スイート / ai-camera-suite
cyberagentdevelopers
PRO
3
240
TinyMLの技術動向
kyotomon
2
270
年10万で社内Webアプリを10個動かす チャレンジをしている話 / The story of the challenge to run 10 in-house web apps for 100kJPY a year.
yamaguchitk333
0
110
CI/CDやテスト自動化の開発プロジェクトへの適用
megascus
3
680
マネジメント視点でのre:Invent参加 ~もしCEOがre:Inventに行ったら~
kojiasai
0
180
APIテスト自動化の勘所
yokawasa
6
3.1k
AI Builder について
miyakemito
1
140
小規模に始めるデータメッシュとデータガバナンスの実践
kimujun
3
380
AWS re:Inventを徹底的に楽しむためのTips / Tips for thoroughly enjoying AWS re:Invent
yuj1osm
0
300
Databricksワークショップ - 生成AIとDWH
taka_aki
2
4.5k
急成長中のWINTICKETにおける品質と開発スピードと向き合ったQA戦略と今後の展望 / winticket-autify
cyberagentdevelopers
PRO
1
150
最速最小からはじめるデータプロダクト / Data Product MVP
amaotone
2
580
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
43
13k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
280
A designer walks into a library…
pauljervisheath
202
24k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
41
9.2k
How STYLIGHT went responsive
nonsquared
95
5.1k
A Modern Web Designer's Workflow
chriscoyier
692
190k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
RailsConf 2023
tenderlove
29
870
How to train your dragon (web standard)
notwaldorf
88
5.6k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
780
It's Worth the Effort
3n
183
27k
Unsuck your backbone
ammeep
668
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·͞ʹͦΕΛ࣮͍ͯ͠Δɻ