1App::cpm::Tutorial(3pm)User Contributed Perl DocumentatioAnpp::cpm::Tutorial(3pm)
2
3
4

NAME

6       App::cpm::Tutorial - How to use cpm
7

SYNOPSIS

9         $ cpm install Module
10

DESCRIPTION

12       cpm is yet another CPAN client (like cpan, cpanp, and cpanm), which is
13       fast!
14
15   How to install cpm
16       From CPAN:
17
18         $ cpanm -nq App::cpm
19
20       Or, download a self-contained cpm:
21
22         $ curl -sL --compressed https://git.io/cpm > cpm
23         $ chmod +x cpm
24         $ ./cpm --version
25
26         # you can even install modules without installing cpm
27         $ curl -sL --compressed https://git.io/cpm | perl - install Plack
28
29   First step
30         $ cpm install Plack
31
32       This command installs Plack into "./local", and you can use it by
33
34         $ perl -I$PWD/local/lib/perl5 -MPlack -E 'say Plack->VERSION'
35
36       If you want to install modules into current INC instead of "./local",
37       then use "--global/-g" option.
38
39         $ cpm install --global Plack
40
41       By default, cpm outputs only "DONE install Module" things.  If you want
42       more verbose messages, use "--verbose/-v" option.
43
44         $ cpm install --verbose Plack
45
46   Second step
47       cpm can handle version range notation like cpanm. Let's see some
48       examples.
49
50         $ cpm install Plack~'> 1.000, <= 2.000'
51         $ cpm install Plack~'== 1.0030'
52         $ cpm install Plack@1.0030  # this is an alias of ~'== 1.0030'
53
54       cpm can install dev releases (TRIAL releases).
55
56         $ cpm install Moose@dev
57
58         # if you prefer dev releases for not only Moose,
59         # but also its dependencies, then use global --dev option
60         $ cpm install --dev Moose
61
62       And cpm can install modules from git repositories directly.
63
64         $ cpm install git://github.com/skaji/Carl.git
65
66   cpanfile and dist/url/mirror/git syntax
67       If you omit arguments, and there exists "cpanfile" in the current
68       directory, then cpm loads modules from cpanfile, and install them
69
70         $ cat cpanfile
71         requires 'Moose', '2.000';
72         requires 'Plack', '> 1.000, <= 2.000';
73         $ cpm install
74
75       If you have "cpanfile.snapshot", then cpm tries to resolve distribution
76       names from it
77
78         $ cpm install -v
79         30186 DONE resolve (0.001sec) Plack -> Plack-1.0030 (from Snapshot)
80         ...
81
82       cpm supports dist/url/mirror syntax in cpanfile just like cpanminus:
83
84         requires 'Path::Class', 0.26,
85           dist => "KWILLIAMS/Path-Class-0.26.tar.gz";
86
87         # use dist + mirror
88         requires 'Cookie::Baker',
89           dist => "KAZEBURO/Cookie-Baker-0.08.tar.gz",
90           mirror => "http://cpan.cpantesters.org/";
91
92         # use the full URL
93         requires 'Try::Tiny', 0.28,
94           url => "http://backpan.perl.org/authors/id/E/ET/ETHER/Try-Tiny-0.28.tar.gz";
95
96       And yes, this is an experimental and fun part! cpm also supports git
97       syntax in cpanfile.
98
99         requires 'Carl', git => 'git://github.com/skaji/Carl.git';
100         requires 'App::cpm', git => 'https://login:password@github.com/skaji/cpm.git';
101         requires 'Perl::PrereqDistributionGatherer',
102           git => 'https://github.com/skaji/Perl-PrereqDistributionGatherer',
103           ref => '3850305'; # ref can be revision/branch/tag
104
105       Please note that to support git syntax in cpanfile wholly, there are
106       several TODOs.
107
108   Darkpan integration
109       There are CPAN modules that create darkpans (minicpan, CPAN mirror)
110       such as CPAN::Mini, OrePAN2, Pinto.
111
112       Such darkpans store distribution tarballs in
113
114         DARKPAN/authors/id/A/AU/AUTHOR/Module-0.01.tar.gz
115
116       and create the de facto standard index file "02packages.details.txt.gz"
117       in
118
119         DARKPAN/modules/02packages.details.txt.gz
120
121       If you want to use cpm against such darkpans, change the cpm resolver
122       by "--resolver/-r" option:
123
124         $ cpm install --resolver 02packages,http://example.com/darkpan Module
125         $ cpm install --resolver 02packages,file::///path/to/darkpan   Module
126
127       Sometimes, your darkpan is not whole CPAN mirror, but partial, so some
128       modules are missing in it.  Then append "--resolver metadb" option to
129       fall back to normal MetaDB resolver:
130
131         $ cpm install \
132            --resolver 02packages,http://example.com/darkpan \
133            --resolver metadb \
134            Module
135
136
137
138perl v5.28.0                      2018-08-01           App::cpm::Tutorial(3pm)
Impressum