One of the best things about Perl is CPAN, Perl’s comprehensive archives network. This is a mirroring service that, since Perl 5 was originally released, has allowed people to share useful add-ons, such as XML::Simple or SOAP::Lite , using the standard, common tool cpan client that comes with Perl. Almost all Perl distributions (such as Strawberry Perl and most Perl distributions shipped with Linux) have a CPAN client that is configured and included in it. This client allows people to download and install modules from CPAN just by knowing the name of the module.
Almost all CPAN module distributions correspond to the exact layout. Usually they have a Makefile.PL file (if it uses ExtUtils :: MakeMaker to generate a script installation file), Build.PL (if it uses Module :: Build to generate a script installation), or both. These Perl scripts, after starting, create a "Makefile" or "Build" file that allows you to install the module and make sure that all the necessary conditions are met.
If you've never done a Perl distribution before, you can download any distribution from CPAN and see how it went. Folders and file locations are pretty intuitive as soon as you notice them. They are usually installed with a script installation file and supporting files (for example, readme) in the root directory with custom modules (the modules you make) in the lib directory and with unit tests in the t directory.
I would recommend looking at Build.PL if you are a beginner; these are pure Perl-based installation scripts. If you decide to create a distribution based on Module.PL, it is very easy to indicate that XML::Simple and SOAP::Lite are needed to distribute your module. First, create a basic installation based on the :: Build script module. It looks something like this:
use Module::Build; my $build = Module::Build->new( module_name => 'Foo::Bar', license => 'perl', requires => { 'perl' => '5.6.1', 'Some::Module' => '1.23', 'Other::Module' => '>= 1.2, != 1.5, < 2.0', }, ); $build->create_build_script;
(This is taken directly from Module :: Build :: Authoring docs).
Then specify the required libraries and their minimum versions. Zero (0) is an acceptable version if you don't care, but that means “everything” is good. I would recommend specifying at least the version of libraries installed on the machines under test.
(A clear abbreviation: you can find out the version of any library that has the $ VERSION package variable set with:
perl -MSome::Lib -E "say Some::Lib->VERSION()"
.)
To install the module, the steps look something like this:
cd folder\where\my\lib\is perl Build.PL Build Build test Build install
This will create an installation tool, prepare a folder for testing (usually just copy the material to the assembly library area for simple modules), run all the .t scripts in the t folder (the “tests” that Test::More usually use for unit unit testing before installation), and then finally install your module in the libraries of your PC on Perl.
Build script, as part of the “configure things” phase, will review your premises and alert you if you do not already have them.
Then, as pointed out by ikegami's answer, if you use the cpanm client to install your library, the cpan client will automatically exit, download, verify and install its dependencies for you! Alternatively, installers based on Build.PL also have the option "installdeps", which will do the same. Then, any and all dependencies (and potentially recursive dependencies) are automatically downloaded, tested, and installed, even if they change in the future.