0x1949 Team - FAZEMRX - MANAGER
Edit File: cpanfile-faq.3pm
.\" 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 "cpanfile-faq 3pm" .TH cpanfile-faq 3pm "2018-04-26" "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" cpanfile\-faq \- cpanfile FAQ .SH "QUESTIONS" .IX Header "QUESTIONS" .SS "Does cpanfile replace Makefile.PL/Build.PL or \s-1META\s0.yml/json?" .IX Subsection "Does cpanfile replace Makefile.PL/Build.PL or META.yml/json?" No, it doesn't. \f(CW\*(C`cpanfile\*(C'\fR is a simpler way to declare \s-1CPAN\s0 dependencies, mainly for \fIyour application\fR rather than \s-1CPAN\s0 distributions. .PP However, while \s-1CPAN\s0 distributions do not need to \fBswitch\fR to \&\f(CW\*(C`cpanfile\*(C'\fR, you can certainly \fImanage\fR the dependencies in \&\f(CW\*(C`cpanfile\*(C'\fR, then export them into \f(CW\*(C`META.json\*(C'\fR files when shipping to \&\s-1CPAN,\s0 using tools such as Dist::Milla or Module::Install::CPANfile .SS "Why do we need yet another format?" .IX Subsection "Why do we need yet another format?" Here are some of the reasons that motivates the new cpanfile format. .IP "Not everything is a \s-1CPAN\s0 distribution" 4 .IX Item "Not everything is a CPAN distribution" First of all, it is annoying to write (a dummy) \f(CW\*(C`Makefile.PL\*(C'\fR when what you develop is not a \s-1CPAN\s0 distribution, just so that installation like \f(CW\*(C`cpanm \-\-installdeps .\*(C'\fR would work. .Sp It gets more painful when you develop a web application that you want to deploy on a different environment using version control system (such as PaaS/cloud infrastructure), because it requires you to often commit the \s-1META\s0 file or \f(CW\*(C`inc/\*(C'\fR directory (or even worse, both) to a repository. .Sp Many web application frameworks generate a boiler-plate \f(CW\*(C`Makefile.PL\*(C'\fR for dependency declaration and to let you install dependencies with \&\f(CW\*(C`cpanm \-\-installdeps .\*(C'\fR, but that doesn't always mean they are meant to be installed. Things can be often much simpler if you run the application from the checkout directory. .Sp With cpanfile, dependencies can be installed either globally or locally using supported tools such as cpanm or Carton. Because \&\f(CW\*(C`cpanfile\*(C'\fR lists all the dependencies of your entire application and will be updated over time, it makes perfect sense to commit the file to a version control system, and push the file for a deployment. .IP "Familiar \s-1DSL\s0 syntax" 4 .IX Item "Familiar DSL syntax" This is a new file type, but the format and syntax isn't entirely new. The metadata it can declare is exactly a subset of \*(L"Prereqs\*(R" in \&\s-1CPAN\s0 Meta Spec. .Sp The syntax borrows a lot from Module::Install. Module::Install is a great way to easily declare module metadata such as name, author and dependencies. cpanfile format is simply to extract the dependencies into a separate file, which means most of the developers are familiar with the syntax. .IP "Complete \s-1CPAN\s0 Meta Spec v2 support" 4 .IX Item "Complete CPAN Meta Spec v2 support" \&\f(CW\*(C`cpanfile\*(C'\fR basically allows you to declare CPAN::Meta::Spec prerequisite specification using an easy Perl \s-1DSL\s0 syntax. This makes it easy to declare per-phase dependencies and newer version 2 features such as conflicts and version ranges. .ie n .SS "How can I start using ""cpanfile""?" .el .SS "How can I start using \f(CWcpanfile\fP?" .IX Subsection "How can I start using cpanfile?" First of all, most distributions on \s-1CPAN\s0 are not required to update to this format. .PP If your application currently uses \f(CW\*(C`Makefile.PL\*(C'\fR etc. for dependency declaration because of the current toolchain implementation (e.g. \f(CW\*(C`cpanm \-\-installdeps .\*(C'\fR), you can upgrade to \f(CW\*(C`cpanfile\*(C'\fR while keeping the build file based installation working for the backward compatibility. .PP If you are an author of \s-1CPAN\s0 module and want to manage \s-1CPAN\s0 module prerequisites using \f(CW\*(C`cpanfile\*(C'\fR you can use one of the following tools: .IP "Dist::Milla" 4 .IX Item "Dist::Milla" Dist::Milla is a profile for Dist::Zilla that has a \f(CW\*(C`cpanfile\*(C'\fR support to declare dependencies for your module. .IP "Dist::Zilla" 4 .IX Item "Dist::Zilla" Dist::Zilla::Plugin::Prereqs::FromCPANfile provides a way to merge dependencies declared in \f(CW\*(C`cpanfile\*(C'\fR into \s-1META\s0 files as well as build files. You can combine them using other prerequisite scanners like \&\f(CW\*(C`AutoPrereqs\*(C'\fR. .IP "Minilla" 4 .IX Item "Minilla" Minilla is a yet another authoring tool that supports \f(CW\*(C`cpanfile\*(C'\fR as a way to describe dependencies for your \s-1CPAN\s0 module. .IP "Module::Install" 4 .IX Item "Module::Install" Module::Install::CPANfile provides a \f(CW\*(C`cpanfile\*(C'\fR \s-1DSL\s0 that reads \&\f(CW\*(C`cpanfile\*(C'\fR to merge prerequisites when dumping \f(CW\*(C`MYMETA\*(C'\fR files upon installation. .IP "Module::Build" 4 .IX Item "Module::Build" Module::Build::Pluggable::CPANfile merges \f(CW\*(C`cpanfile\*(C'\fR dependencies from \f(CW\*(C`Build.PL\*(C'\fR when dumping out \s-1MYMETA\s0 information. .Sp However you're recommended to switch to an authoring system that emits \&\f(CW\*(C`Build.PL\*(C'\fR with parsed CPANfile information, like Dist::Zilla mentioned above. .IP "ExtUtils::MakeMaker" 4 .IX Item "ExtUtils::MakeMaker" ExtUtils::MakeMaker::CPANfile merges \f(CW\*(C`cpanfile\*(C'\fR prerequisites when dumping \f(CW\*(C`MYMETA\*(C'\fR files upon installation. .Sp However you're recommended to switch to an authoring system that emits \&\f(CW\*(C`Makefile.PL\*(C'\fR with parsed CPANfile information, like Dist::Zilla mentioned above.