Perl Application Distribution

I recently created a small Perl application that uses several non-core modules that will need to be installed through CPAN.

Is there a way to distribute the application with the ability to check if the necessary modules are installed and pull them out of the CPAN if they are not? I assume I'm looking for something similar to the CPAN auto-install feature.

I thought about using the starter module and :: Install module to create a structure similar to the module, and then adapted the assembly file to install the application in / bin ... but I'm not sure if this boot is a mountainous solution.

+4
source share
2 answers

This is not a shoe solution, but the right thing. You must allow a specialized tool to handle dependencies due to angular cases, for example. write in the installation instructions:

  • Unzip the archive.
  • Run cpan . in a directory without access.

You do not need to modify the assembly file to install programs in the bin , this is done by default.

+3
source
 BEGIN { eval "use evil::module"; if( $@ ) { `sudo perl -MCPAN -e 'install evil::module'`; exit ; } } 
  • You can easily check if any module is present, and a) try to install it and exit / restart the application b) croak / die. (sth, as in the code snippet above)

  • You can also attach the modules you want to pack, extract them to a specific directory and click the directory in @INC in the start block.

-1
source

All Articles