The build file for Module::Extract::Use
This build file is a modulino; it works as both a build script and a module.
To build the distribution, run this file normally:
% perl Makefile.PL
But, it's more interesting than that. You can load it with require
and call arguments
to get the data structure it passes to WriteMakefile
:
my $package = require '/path/to/Makefile.PL';
my $arguments = $package->arguments;
Note that require
-ing a file makes an entry in %INC
for exactly that name. If you try to require
another file with the same name, even from a different path, require
thinks it has already loaded the file. As such, I recommend you always require the full path to the file.
The return value of the require
is a package name (in this case, the name of the main module. Use that to call the arguments
method.
Even if this distribution needs a higher version of Perl, this bit only needs v5.8. You can play with the data structure with a primitive Perl.