.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "cpanfile-faq 3" .TH cpanfile-faq 3 2026-07-15 "perl v5.42.2" "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 META.yml/json?" .IX Subsection "Does cpanfile replace Makefile.PL/Build.PL or META.yml/json?" No, it doesn\*(Aqt. \f(CW\*(C`cpanfile\*(C'\fR is a simpler way to declare CPAN dependencies, mainly for \fIyour application\fR rather than CPAN distributions. .PP However, while CPAN 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 CPAN, 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 CPAN 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 CPAN 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 META 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\*(Aqt 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 DSL syntax" 4 .IX Item "Familiar DSL syntax" This is a new file type, but the format and syntax isn\*(Aqt entirely new. The metadata it can declare is exactly a subset of "Prereqs" in CPAN 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 CPAN 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 DSL 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 CPAN 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 CPAN module and want to manage CPAN 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 META 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 CPAN module. .IP Module::Install 4 .IX Item "Module::Install" Module::Install::CPANfile provides a \f(CW\*(C`cpanfile\*(C'\fR DSL 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 MYMETA information. .Sp However you\*(Aqre 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\*(Aqre 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.