Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a quick way to run a single script to automatically install missing modules using only Perl core?

I inherited a project which is supposed to be able to be deployed to other servers. This project has a number of simple module dependencies which however might not be present on all target machines.

As such I'd like to be able to run a single command line script that checks which Perl modules are installed and tries to automatically install missing ones via CPAN.

Since this should be very basic (i.e. needing to install stuff to run the module installer would defeat the point) said script should only use Perl 5.8.8 core modules.

Does something like that exist already or would i need to write it myself?

like image 747
Mithaldu Avatar asked Jan 07 '10 10:01

Mithaldu


2 Answers

Creating a Bundle package is one possible answer.

You can then look at something like CPAN::Shell (see CPAN module) to automate the process.

/I3az/

Update re: brian's comment about Task:: - Here are some pertinent links:

  • Writing a CPAN Task (using Module::Install)
  • "Task:: or Bundle::"? (Perlmonks)
like image 83
draegtun Avatar answered Nov 08 '22 11:11

draegtun


Use Module::Install, it will be bundled with your module/program. You can use "auto_install" command to automatically install dependencies.

like image 41
Alexandr Ciornii Avatar answered Nov 08 '22 12:11

Alexandr Ciornii