1Carton(3)             User Contributed Perl Documentation            Carton(3)
2
3
4

NAME

6       Carton - Perl module dependency manager (aka Bundler for Perl)
7

SYNOPSIS

9         # On your development environment
10         > cat cpanfile
11         requires 'Plack', '0.9980';
12         requires 'Starman', '0.2000';
13
14         > carton install
15         > git add cpanfile cpanfile.snapshot
16         > git commit -m "add Plack and Starman"
17
18         # Other developer's machine, or on a deployment box
19         > carton install
20         > carton exec starman -p 8080 myapp.psgi
21
22         # carton exec is optional
23         > perl -Ilocal/lib/perl5 local/bin/starman -p 8080 myapp.psgi
24         > PERL5LIB=/path/to/local/lib/perl5 /path/to/local/bin/starman -p 8080 myapp.psgi
25

AVAILABILITY

27       Carton only works with perl installation with the complete set of core
28       modules. If you use perl installed by a vendor package with modules
29       stripped from core, Carton is not expected to work correctly.
30
31       Also, Carton requires you to run your command/application with "carton
32       exec" command or to include the local/lib/perl5 directory in your Perl
33       library search path (using "PERL5LIB", "-I", or lib).
34

DESCRIPTION

36       carton is a command line tool to track the Perl module dependencies for
37       your Perl application. Dependencies are declared using cpanfile format,
38       and the managed dependencies are tracked in a cpanfile.snapshot file,
39       which is meant to be version controlled, and the snapshot file allows
40       other developers of your application will have the exact same versions
41       of the modules.
42
43       For "cpanfile" syntax, see cpanfile documentation.
44

TUTORIAL

46   Initializing the environment
47       carton will use the local directory to install modules into. You're
48       recommended to exclude these directories from the version control
49       system.
50
51         > echo local/ >> .gitignore
52         > git add cpanfile cpanfile.snapshot
53         > git commit -m "Start using carton"
54
55   Tracking the dependencies
56       You can manage the dependencies of your application via "cpanfile".
57
58         # cpanfile
59         requires 'Plack', '0.9980';
60         requires 'Starman', '0.2000';
61
62       And then you can install these dependencies via:
63
64         > carton install
65
66       The modules are installed into your local directory, and the
67       dependencies tree and version information are analyzed and saved into
68       cpanfile.snapshot in your directory.
69
70       Make sure you add cpanfile and cpanfile.snapshot to your version
71       controlled repository and commit changes as you update dependencies.
72       This will ensure that other developers on your app, as well as your
73       deployment environment, use exactly the same versions of the modules
74       you just installed.
75
76         > git add cpanfile cpanfile.snapshot
77         > git commit -m "Added Plack and Starman"
78
79   Specifying a CPAN distribution
80       You can pin a module resolution to a specific distribution using a
81       combination of "dist", "mirror" and "url" options in "cpanfile".
82
83         # specific distribution on PAUSE
84         requires 'Plack', '== 0.9980',
85           dist => 'MIYAGAWA/Plack-0.9980.tar.gz';
86
87         # local mirror (darkpan)
88         requires 'Plack', '== 0.9981',
89           dist => 'MYCOMPANY/Plack-0.9981-p1.tar.gz',
90           mirror => 'https://pause.local/';
91
92         # URL
93         requires 'Plack', '== 1.1000',
94           url => 'https://pause.local/authors/id/M/MY/MYCOMPANY/Plack-1.1000.tar.gz';
95
96   Deploying your application
97       Once you've done installing all the dependencies, you can push your
98       application directory to a remote machine (excluding local and .carton)
99       and run the following command:
100
101         > carton install --deployment
102
103       This will look at the cpanfile.snapshot and install the exact same
104       versions of the dependencies into local, and now your application is
105       ready to run.
106
107       The "--deployment" flag makes sure that carton will only install
108       modules and versions available in your snapshot, and won't fallback to
109       query for CPAN Meta DB for missing modules.
110
111   Bundling modules
112       carton can bundle all the tarballs for your dependencies into a
113       directory so that you can even install dependencies that are not
114       available on CPAN, such as internal distribution aka DarkPAN.
115
116         > carton bundle
117
118       will bundle these tarballs into vendor/cache directory, and
119
120         > carton install --cached
121
122       will install modules using this local cache. Combined with
123       "--deployment" option, you can avoid querying for a database like CPAN
124       Meta DB or downloading files from CPAN mirrors upon deployment time.
125
126       As of Carton v1.0.32, the bundle also includes a package index allowing
127       you to simply use cpanm (which has a standalone version) instead of
128       installing Carton on a remote machine.
129
130         > cpanm -L local --from "$PWD/vendor/cache" --installdeps --notest --quiet .
131

PERL VERSIONS

133       When you take a snapshot in one perl version and deploy on another
134       (different) version, you might have troubles with core modules.
135
136       The simplest solution, which might not work for everybody, is to use
137       the same version of perl in the development and deployment.
138
139       To enforce that, you're recommended to use plenv and ".perl-version" to
140       lock perl versions in development.
141
142       You can also specify the minimum perl required in "cpanfile":
143
144         requires 'perl', '5.16.3';
145
146       and carton (and cpanm) will give you errors when deployed on hosts with
147       perl lower than the specified version.
148

COMMUNITY

150       <https://github.com/perl-carton/carton>
151           Code repository, Wiki and Issue Tracker
152
153       <irc://irc.perl.org/#cpanm>
154           IRC chat room
155

AUTHOR

157       Tatsuhiko Miyagawa
158
160       Tatsuhiko Miyagawa 2011-
161

LICENSE

163       This software is licensed under the same terms as Perl itself.
164

SEE ALSO

166       cpanm
167
168       cpanfile
169
170       Bundler <http://gembundler.com/>
171
172       pip <http://pypi.python.org/pypi/pip>
173
174       npm <http://npmjs.org/>
175
176       perlrocks <https://github.com/gugod/perlrocks>
177
178       only
179
180
181
182perl v5.34.0                      2022-01-20                         Carton(3)
Impressum