With pip you are able to create a requirements file to specify which libraries to install. Is there an equivalent for perl modules using CPAN?
I came across ExtUtils::MakeMaker, but this seems like the make file is for each module specifically.
I guess to try and give a better idea of what I am asking is if there is a way to do something like
cpan install -r requirements.txt
and then specify which modules to install in that requirements file.
Thanks in advance!
The Comprehensive Perl Archive Network (CPAN) is a repository of over 250,000 software modules and accompanying documentation for 39,000 distributions, written in the Perl programming language by over 12,000 contributors.
To install Perl modules using CPAN, you need to use the cpan command-line utility. You can either run cpan with arguments from the command-line interface, for example, to install a module (e.g Geo::IP) use the -i flag as shown.
Available commands are: l - List all installed modules m - Select a module q - Quit the program cmd? Sample outputs: Installed modules are: JavaScript::SpiderMonkey Log::Log4perl Perl cmd?
When you install modules from CPAN, each module specifies its dependencies in the Makefile.PL (or Build.PL) and the CPAN shell will resolve those dependencies recursively when installing.
If you want to specify dependencies for an application (rather than a CPAN module), you can create a file called cpanfile
in this format:
requires 'JSON';
requires 'Template';
requires 'DateTime';
requires 'DBIx::Class';
Then you can install those dependencies with one command:
cpanm --installdeps .
The cpanm
command comes from the App::cpanminus distribution and is an alternative tool for installing modules from CPAN.
See the cpanfile docs for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With