1Carton::Doc::FAQ(3)   User Contributed Perl Documentation  Carton::Doc::FAQ(3)
2
3
4

NAME

6       Carton::Doc::FAQ - Frequently Asked Questions
7

QUESTIONS

9   It looks useful, but what is the use case of this tool?
10       The particular problem that carton is trying to address is this:
11
12       You develop a Perl-based application, possibly but not limited to
13       webapps, with dozens of CPAN module dependencies. You install these
14       modules on your development machine, and describe these dependencies in
15       your cpanfile.
16
17       Now you get a production environment, either on PaaS provider or some
18       VPS, you install the dependencies using "cpanm --installdeps ." and it
19       will pull all the latest releases from CPAN as of today and everything
20       just works.
21
22       A few weeks later, your application becomes more popular, and you think
23       you need another machine to serve more requests. You set up another
24       machine with vanilla perl installation and install the dependencies the
25       same way. That will pull the latest releases from CPAN on that date,
26       rather than the same as what you have today.
27
28       And that is the problem. It's not likely that everything just breaks
29       one day, but there's always a chance that one of the dependencies
30       breaks an API compatibility, or just uploaded a buggy version to CPAN
31       on that particular day.
32
33       Carton allows you to lock these dependencies into a version controlled
34       system, so that every time you deploy from a checkout, it is guaranteed
35       that all the same versions are installed into the local environment.
36
37   How is this different from Pinto or CPAN::Mini::Inject?
38       carton definitely shares the goal with these private CPAN repository
39       management tool. But the main difference is that rather than creating
40       an actual CPAN-like repository that works with any CPAN clients, Carton
41       provides a way to install specific versions of distributions from CPAN,
42       or any CPAN-like mirrors (as well as git repositories in the future
43       version of Carton).
44
45       Existing tools are designed to work with CPAN clients such as CPAN or
46       CPANPLUS, and have accomplished that by working around the CPAN mirror
47       structure.
48
49       carton internally does the same thing, but its user interface is
50       centered around the installer, by implementing a wrapper for cpanm, so
51       you can use the same commands in the development mode and deployment
52       mode.
53
54       Carton automatically maintains the cpanfile.snapshot file, which is
55       meant to be version controlled, inside your application directory. You
56       don't need a separate database, a directory or a web server to maintain
57       tarballs outside your application. The cpanfile.snapshot file can
58       always be generated with "carton install" command, and "carton install"
59       on another machine can use the version in the snapshot.
60
61   I already use Pinto to create DarkPAN mirror. Can I use Carton with this?
62       Yes, by specifying Pinto mirror as your Carton mirror, you can take a
63       snapshot of your dependencies including your private modules on Pinto,
64       or whatever DarkPAN mirror.
65
66   I'm already using perlbrew and local::lib. Can I use carton with this?
67       If you're using local::lib already with perlbrew perl, possibly with
68       the new "perlbrew lib" command, that's great! There are multiple
69       benefits over using perlbrew and local::lib for development and use
70       Carton for deployment.
71
72       The best practice and workflow to get your perl environment as clean as
73       possible with lots of modules installed for quick development would be
74       this:
75
76       ·   Install fresh perl using perlbrew. The version must be the same
77           against the version you'll run on the production environment.
78
79       ·   Once the installation is done, use "perlbrew lib" command to create
80           a new local lib environment (let's call it devel) and always use
81           the library as a default environment. Install as many modules as
82           you would like into the devel library path.
83
84           This ensures to have a vanilla "perl" library path as clean as
85           possible.
86
87       ·   When you build a new project that you want to manage dependencies
88           via Carton, turn off the devel local::lib and create a new one,
89           like myapp. Install Carton and all of its dependencies to the myapp
90           local::lib path. Then run "carton install" like you normally do.
91
92           Because devel and myapp are isolated, the modules you installed
93           into devel doesn't affect the process when carton builds the
94           dependency tree for your new project at all. This could often be
95           critical when you have a conditional dependency in your tree, like
96           Any::Moose.
97
98   I'm using perlbrew, but "carton install" uses system perl, how to fix?
99       The issue is most likelly caused by a inital bad install of "cpanm" or
100       "carton" or both, that ended up with a shebang line pointed to the
101       (wrong) system perl.
102
103       Re-install Carton on you perlbrew environment
104           Run "cpanm -f Carton". This will force-install Carton, and because
105           your "cpanm" is now using the correct "perl", the same will happen
106           with "carton".
107
108       Make sure the shebang (the first line) of your "carton" script points
109       to the right perl path, rather than "/usr/bin/perl".
110
111
112
113perl v5.30.1                      2020-01-29               Carton::Doc::FAQ(3)
Impressum