Makefile.PL of Module::Install
Module::Install does not use a separate file, it uses Makefile.PL, it just has a different API. Because Module::Install does not come with standard Perl, it works differnt then ExtUtils::MakeMaker.
On the development machine, where you work on the module and where you would like to release it, you'll need to install Module::Install but when you package your module a part of Module::Install will be included in your distribution in the inc/ subdirectory. When someone tries to install this distribution, perl will automaticall use this copy of Module::Install.
Makefile.PL we load inc::Module::Install.
use strict; use warnings; use 5.008; use inc::Module::Install 1.00; name 'App'; license 'perl'; author 'Gabor Szabo'; all_from 'lib/App.pm'; requires 'perl' => '5.008'; requires 'File::Basename'; # no version number requires 'Win32' => '0.31' if $^O =~ /win32/i; # conditional requirement test_requires 'Test::More' => '0.47'; homepage 'http://padre.perlide.org/'; bugtracker 'http://padre.perlide.org/trac/'; repository 'http://svn.perlide.org/padre/trunk/Padre/'; install_script 'script/app.pl'; # install_share; # will install the share/ directory from the distribution # to be found by File::ShareDir::dist_dir('App') late on WriteAll;
Some of the keys that you can use in the Makefile.PL
name is the name of your distribution.
license is the type of license the code has. perl would mean the "perl license".
author is the name and the e-mail of the person who created the module.
all_from tells where to get the version number and the abstract of the distribution from. This usually points at the main module.
requires can be issued multiple times. Each time it gets a either a single value, a name of a module, or a key-value pair. A name of a module and a mimimum version number. This is the list of prerequisites. If only the name of the required module is given then we don't care which version of that module.
One of the requirements in this example is only relevant on MS Windows. Therefore, we check the $^O variable that indicates the operating system, and only if it is Windows, only then do we call the requires function.
requires 'Win32' => '0.31' if $^O =~ /win32/i;
test_requires helps you list the modules that are needed when testing the module even though they are not needed for the actual use of the module.
The keywords homepage, bugtracker, repository help the user declare various other resources for this distribution. The information provided here will be added to the META files (META.yml and META.json) and then they will be used by the various displying system, such as MetaCPAN to link to these resources.
install_script can be used to designate perl-scripts to be installed.
install_share helps you add even more files (e.g. templates, images etc.)
Finally, after have declared everything we can call WriteAll that will check everything declared above and create the Makefile to be used by the installer.