.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" 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::Doc::FAQ 3pm" .TH Carton::Doc::FAQ 3pm "2020-11-04" "perl v5.30.3" "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::Doc::FAQ \- Frequently Asked Questions .SH "QUESTIONS" .IX Header "QUESTIONS" .SS "It looks useful, but what is the use case of this tool?" .IX Subsection "It looks useful, but what is the use case of this tool?" The particular problem that carton is trying to address is this: .PP You develop a Perl-based application, possibly but not limited to webapps, with dozens of \s-1CPAN\s0 module dependencies. You install these modules on your development machine, and describe these dependencies in your \fIcpanfile\fR. .PP Now you get a production environment, either on PaaS provider or some \&\s-1VPS,\s0 you install the dependencies using \f(CW\*(C`cpanm \-\-installdeps .\*(C'\fR and it will pull all the latest releases from \s-1CPAN\s0 as of today and everything just works. .PP A few weeks later, your application becomes more popular, and you think you need another machine to serve more requests. You set up another machine with vanilla perl installation and install the dependencies the same way. That will pull the \fIlatest\fR releases from \&\s-1CPAN\s0 \fIon that date\fR, rather than the same as what you have today. .PP And that is the problem. It's not likely that everything just breaks one day, but there's always a chance that one of the dependencies breaks an \s-1API\s0 compatibility, or just uploaded a buggy version to \s-1CPAN\s0 on that particular day. .PP Carton allows you to \fIlock\fR these dependencies into a version controlled system, so that every time you deploy from a checkout, it is guaranteed that all the same versions are installed into the local environment. .SS "How is this different from Pinto or CPAN::Mini::Inject?" .IX Subsection "How is this different from Pinto or CPAN::Mini::Inject?" carton definitely shares the goal with these private \s-1CPAN\s0 repository management tool. But the main difference is that rather than creating an actual CPAN-like repository that works with any \s-1CPAN\s0 clients, Carton provides a way to install specific versions of distributions from \s-1CPAN,\s0 or any CPAN-like mirrors (as well as git repositories in the future version of Carton). .PP Existing tools are designed to work \fIwith\fR \s-1CPAN\s0 clients such as \&\s-1CPAN\s0 or \s-1CPANPLUS\s0, and have accomplished that by working around the \s-1CPAN\s0 mirror structure. .PP carton \fIinternally\fR does the same thing, but its user interface is centered around the installer, by implementing a wrapper for cpanm, so you can use the same commands in the development mode and deployment mode. .PP Carton automatically maintains the cpanfile.snapshot file, which is meant to be version controlled, inside your application directory. You don't need a separate database, a directory or a web server to maintain tarballs outside your application. The \fIcpanfile.snapshot\fR file can always be generated with \f(CW\*(C`carton install\*(C'\fR command, and \f(CW\*(C`carton install\*(C'\fR on another machine can use the version in the snapshot. .SS "I already use Pinto to create DarkPAN mirror. Can I use Carton with this?" .IX Subsection "I already use Pinto to create DarkPAN mirror. Can I use Carton with this?" Yes, by specifying Pinto mirror as your Carton mirror, you can take a snapshot of your dependencies including your private modules on Pinto, or whatever DarkPAN mirror. .SS "I'm already using perlbrew and local::lib. Can I use carton with this?" .IX Subsection "I'm already using perlbrew and local::lib. Can I use carton with this?" If you're using local::lib already with perlbrew perl, possibly with the new \f(CW\*(C`perlbrew lib\*(C'\fR command, that's great! There are multiple benefits over using perlbrew and local::lib for development and use Carton for deployment. .PP The best practice and workflow to get your perl environment as clean as possible with lots of modules installed for quick development would be this: .IP "\(bu" 4 Install fresh perl using perlbrew. The version must be the same against the version you'll run on the production environment. .IP "\(bu" 4 Once the installation is done, use \f(CW\*(C`perlbrew lib\*(C'\fR command to create a new local lib environment (let's call it \fIdevel\fR) and always use the library as a default environment. Install as many modules as you would like into the \fIdevel\fR library path. .Sp This ensures to have a vanilla \f(CW\*(C`perl\*(C'\fR library path as clean as possible. .IP "\(bu" 4 When you build a new project that you want to manage dependencies via Carton, turn off the \fIdevel\fR local::lib and create a new one, like \&\fImyapp\fR. Install Carton and all of its dependencies to the \&\fImyapp\fR local::lib path. Then run \f(CW\*(C`carton install\*(C'\fR like you normally do. .Sp Because \fIdevel\fR and \fImyapp\fR are isolated, the modules you installed into \fIdevel\fR doesn't affect the process when carton builds the dependency tree for your new project at all. This could often be critical when you have a conditional dependency in your tree, like Any::Moose. .ie n .SS "I'm using perlbrew, but ""carton install"" uses system perl, how to fix?" .el .SS "I'm using perlbrew, but \f(CWcarton install\fP uses system perl, how to fix?" .IX Subsection "I'm using perlbrew, but carton install uses system perl, how to fix?" The issue is most likelly caused by a initial bad install of \f(CW\*(C`cpanm\*(C'\fR or \f(CW\*(C`carton\*(C'\fR or both, that ended up with a shebang line pointed to the (wrong) system perl. .IP "Re-install Carton on you perlbrew environment" 4 .IX Item "Re-install Carton on you perlbrew environment" Run \f(CW\*(C`cpanm \-f Carton\*(C'\fR. This will force-install Carton, and because your \f(CW\*(C`cpanm\*(C'\fR is now using the correct \f(CW\*(C`perl\*(C'\fR, the same will happen with \f(CW\*(C`carton\*(C'\fR. .PP Make sure the shebang (the first line) of your \f(CW\*(C`carton\*(C'\fR script points to the right perl path, rather than \f(CW\*(C`/usr/bin/perl\*(C'\fR.