cpanfile-faq(3pm) | User Contributed Perl Documentation | cpanfile-faq(3pm) |
cpanfile-faq - cpanfile FAQ
No, it doesn't. "cpanfile" is a simpler way to declare CPAN dependencies, mainly for your application rather than CPAN distributions.
However, while CPAN distributions do not need to switch to "cpanfile", you can certainly manage the dependencies in "cpanfile", then export them into "META.json" files when shipping to CPAN, using tools such as Dist::Milla or Module::Install::CPANfile
Here are some of the reasons that motivates the new cpanfile format.
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 "inc/" directory (or even worse, both) to a repository.
Many web application frameworks generate a boiler-plate "Makefile.PL" for dependency declaration and to let you install dependencies with "cpanm --installdeps .", 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.
With cpanfile, dependencies can be installed either globally or locally using supported tools such as cpanm or Carton. Because "cpanfile" 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.
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.
First of all, most distributions on CPAN are not required to update to this format.
If your application currently uses "Makefile.PL" etc. for dependency declaration because of the current toolchain implementation (e.g. "cpanm --installdeps ."), you can upgrade to "cpanfile" while keeping the build file based installation working for the backward compatibility.
If you are an author of CPAN module and want to manage CPAN module prerequisites using "cpanfile" you can use one of the following tools:
However you're recommended to switch to an authoring system that emits "Build.PL" with parsed CPANfile information, like Dist::Zilla mentioned above.
However you're recommended to switch to an authoring system that emits "Makefile.PL" with parsed CPANfile information, like Dist::Zilla mentioned above.
2022-11-19 | perl v5.36.0 |