I'd recommend using Module::Starter
to set up a template for each module. Once it's installed, you can call module-starter
from the command line, eg:
module-starter --module=My::Module --author="Jessada Thutkawkorapin" --email=your@email.com
or, if you want a distribution with multiple modules:
module-starter --distro=Foo --module=Foo,Foo::Bar,Foo::Baz --author="Jessada Thutkawkorapin" --email=your@email.com
Then, just overwrite the .pm
files with your modules, include any unit tests that you want to run (the default tests basically check the syntax of the module along with the pod syntax). A basic installation of the modules is then done via
perl Makefile.PL
make
make test
make install
(technically, make test
is optional, but it's highly recommended).
Now, if these modules rely on other CPAN modules, then you can use the module CPAN
to install them, eg:
use strict;
use warnings;
use CPAN;
#populate however you'd like, either hard-coded, read from a file, etc.
my @modules_to_install=();
foreach(@modules_to_install)
{
CPAN::Shell->install($_);
}
So, you can distribute a zip/tarball/etc with the folders and files that module-starter
started (and that you modified) along with the above script to install any CPAN dependencies, and call it, say, cpan_install.pl
. If you want, you can then wrap everything up in a final script called, say, install.pl
that does all of these things.