in reply to Installing CPAN Modules within BEGIN of PERL Script

G'day GhostCode,

Welcome to the Monastery.

"I am working to develop a software distribution that will be run by several users in my environment."

A bit more information about how you're creating this distribution, as well as how knowledgeable your users are with respect to installing Perl modules, would go a long way to providing you with the best help.

I create and modify Perl module distributions on a daily basis as part of my $work. I typically use Module::Starter with a heavily modified Module::Starter::PBP as a plugin.

In Makefile.PL (see ExtUtils::MakeMaker) I specify the dependent modules and required versions under PREREQ_PM (that's a section in the same documentation). Installing My::Module will find any missing modules (or those with earlier versions) and attempt to install them.

If you're intending to upload Your::Module to CPAN, the work is pretty much done for you: installing from CPAN (with the cpan utility, or other similar programs) will — or, at least, should — install all the dependencies.

If your distribution is private, you could potentially just put it in some directory and run `cpan .` (see cpan for more on that). I know that's pretty general but, in the absence of more specific details, that's about the best I can do.

I don't know if you need help with actually creating modules. In case you do, look in the "Reference Manual" section of the "Online Perl Documentation". There's six entries there whose descriptions start with "Perl modules: ": some or all may be useful.

— Ken