How to install a Perl module with CPANP

CPANP saved me the day when I needed to install a Perl module.I never wrote a single line in Perl, but today I had the necessity to install a Perl script along with some dependencies.

In Ubuntu I accomplished that running:
sudo cpanp
to start the module manager.

To actually install the module type the following command. Obviouslu the following example shows how to install the Email::LocalDelivery module. Just change it with the name of the module you want to install.

i Email::LocalDelivery --verbose

cpanp identifies all required dependencies through the web and asks the user if it should try to intall them.

Module 'Email::LocalDelivery' requires 'Email::FolderType' to be installed
1> Yes
2> No
3> Yes to all (for this module)
4> No to allĀ  (for this module)

Just choose “3” and let cpanp manage all dependencies for you.
Eventually, if all works well, cpanp should show you the following confirmation message:

Module 'Email::LocalDelivery' installed successfully
No errors installing all modules