.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Carton 3pm" .TH Carton 3pm "2022-05-12" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Carton \- Perl module dependency manager (aka Bundler for Perl) .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& # On your development environment \& > cat cpanfile \& requires \*(AqPlack\*(Aq, \*(Aq0.9980\*(Aq; \& requires \*(AqStarman\*(Aq, \*(Aq0.2000\*(Aq; \& \& > carton install \& > git add cpanfile cpanfile.snapshot \& > git commit \-m "add Plack and Starman" \& \& # Other developer\*(Aqs machine, or on a deployment box \& > carton install \& > carton exec starman \-p 8080 myapp.psgi \& \& # carton exec is optional \& > perl \-Ilocal/lib/perl5 local/bin/starman \-p 8080 myapp.psgi \& > PERL5LIB=/path/to/local/lib/perl5 /path/to/local/bin/starman \-p 8080 myapp.psgi .Ve .SH "AVAILABILITY" .IX Header "AVAILABILITY" Carton only works with perl installation with the complete set of core modules. If you use perl installed by a vendor package with modules stripped from core, Carton is not expected to work correctly. .PP Also, Carton requires you to run your command/application with \&\f(CW\*(C`carton exec\*(C'\fR command or to include the \fIlocal/lib/perl5\fR directory in your Perl library search path (using \f(CW\*(C`PERL5LIB\*(C'\fR, \f(CW\*(C`\-I\*(C'\fR, or lib). .SH "DESCRIPTION" .IX Header "DESCRIPTION" carton is a command line tool to track the Perl module dependencies for your Perl application. Dependencies are declared using cpanfile format, and the managed dependencies are tracked in a \&\fIcpanfile.snapshot\fR file, which is meant to be version controlled, and the snapshot file allows other developers of your application will have the exact same versions of the modules. .PP For \f(CW\*(C`cpanfile\*(C'\fR syntax, see cpanfile documentation. .SH "TUTORIAL" .IX Header "TUTORIAL" .SS "Initializing the environment" .IX Subsection "Initializing the environment" carton will use the \fIlocal\fR directory to install modules into. You're recommended to exclude these directories from the version control system. .PP .Vb 3 \& > echo local/ >> .gitignore \& > git add cpanfile cpanfile.snapshot \& > git commit \-m "Start using carton" .Ve .SS "Tracking the dependencies" .IX Subsection "Tracking the dependencies" You can manage the dependencies of your application via \f(CW\*(C`cpanfile\*(C'\fR. .PP .Vb 3 \& # cpanfile \& requires \*(AqPlack\*(Aq, \*(Aq0.9980\*(Aq; \& requires \*(AqStarman\*(Aq, \*(Aq0.2000\*(Aq; .Ve .PP And then you can install these dependencies via: .PP .Vb 1 \& > carton install .Ve .PP The modules are installed into your \fIlocal\fR directory, and the dependencies tree and version information are analyzed and saved into \&\fIcpanfile.snapshot\fR in your directory. .PP Make sure you add \fIcpanfile\fR and \fIcpanfile.snapshot\fR to your version controlled repository and commit changes as you update dependencies. This will ensure that other developers on your app, as well as your deployment environment, use exactly the same versions of the modules you just installed. .PP .Vb 2 \& > git add cpanfile cpanfile.snapshot \& > git commit \-m "Added Plack and Starman" .Ve .SS "Specifying a \s-1CPAN\s0 distribution" .IX Subsection "Specifying a CPAN distribution" You can pin a module resolution to a specific distribution using a combination of \f(CW\*(C`dist\*(C'\fR, \f(CW\*(C`mirror\*(C'\fR and \f(CW\*(C`url\*(C'\fR options in \f(CW\*(C`cpanfile\*(C'\fR. .PP .Vb 3 \& # specific distribution on PAUSE \& requires \*(AqPlack\*(Aq, \*(Aq== 0.9980\*(Aq, \& dist => \*(AqMIYAGAWA/Plack\-0.9980.tar.gz\*(Aq; \& \& # local mirror (darkpan) \& requires \*(AqPlack\*(Aq, \*(Aq== 0.9981\*(Aq, \& dist => \*(AqMYCOMPANY/Plack\-0.9981\-p1.tar.gz\*(Aq, \& mirror => \*(Aqhttps://pause.local/\*(Aq; \& \& # URL \& requires \*(AqPlack\*(Aq, \*(Aq== 1.1000\*(Aq, \& url => \*(Aqhttps://pause.local/authors/id/M/MY/MYCOMPANY/Plack\-1.1000.tar.gz\*(Aq; .Ve .SS "Deploying your application" .IX Subsection "Deploying your application" Once you've done installing all the dependencies, you can push your application directory to a remote machine (excluding \fIlocal\fR and \&\fI.carton\fR) and run the following command: .PP .Vb 1 \& > carton install \-\-deployment .Ve .PP This will look at the \fIcpanfile.snapshot\fR and install the exact same versions of the dependencies into \fIlocal\fR, and now your application is ready to run. .PP The \f(CW\*(C`\-\-deployment\*(C'\fR flag makes sure that carton will only install modules and versions available in your snapshot, and won't fallback to query for \s-1CPAN\s0 Meta \s-1DB\s0 for missing modules. .SS "Bundling modules" .IX Subsection "Bundling modules" carton can bundle all the tarballs for your dependencies into a directory so that you can even install dependencies that are not available on \s-1CPAN,\s0 such as internal distribution aka DarkPAN. .PP .Vb 1 \& > carton bundle .Ve .PP will bundle these tarballs into \fIvendor/cache\fR directory, and .PP .Vb 1 \& > carton install \-\-cached .Ve .PP will install modules using this local cache. Combined with \&\f(CW\*(C`\-\-deployment\*(C'\fR option, you can avoid querying for a database like \&\s-1CPAN\s0 Meta \s-1DB\s0 or downloading files from \s-1CPAN\s0 mirrors upon deployment time. .PP As of Carton v1.0.32, the bundle also includes a package index allowing you to simply use cpanm (which has a standalone version) instead of installing Carton on a remote machine. .PP .Vb 1 \& > cpanm \-L local \-\-from "$PWD/vendor/cache" \-\-installdeps \-\-notest \-\-quiet . .Ve .SH "PERL VERSIONS" .IX Header "PERL VERSIONS" When you take a snapshot in one perl version and deploy on another (different) version, you might have troubles with core modules. .PP The simplest solution, which might not work for everybody, is to use the same version of perl in the development and deployment. .PP To enforce that, you're recommended to use plenv and \&\f(CW\*(C`.perl\-version\*(C'\fR to lock perl versions in development. .PP You can also specify the minimum perl required in \f(CW\*(C`cpanfile\*(C'\fR: .PP .Vb 1 \& requires \*(Aqperl\*(Aq, \*(Aq5.16.3\*(Aq; .Ve .PP and carton (and cpanm) will give you errors when deployed on hosts with perl lower than the specified version. .SH "COMMUNITY" .IX Header "COMMUNITY" .IP "" 4 .IX Item "" Code repository, Wiki and Issue Tracker .SH "AUTHOR" .IX Header "AUTHOR" Tatsuhiko Miyagawa .SH "COPYRIGHT" .IX Header "COPYRIGHT" Tatsuhiko Miyagawa 2011\- .SH "LICENSE" .IX Header "LICENSE" This software is licensed under the same terms as Perl itself. .SH "SEE ALSO" .IX Header "SEE ALSO" Carmel .PP cpanm .PP cpanfile .PP Bundler .PP pip .PP npm .PP perlrocks .PP only