Module::MakefilePL::Parse - parse required modules from Makefile.PL
use Module::MakefilePL::Parse; open $fh, 'Makefile.PL'; $parser = Module::MakefilePL::Parse->new( join("", <$fh>) ); $info = $parser->required;
The purpose of this module is to determine the required modules for older CPAN distributions which do not have META.yml files but use Makefile.PL and ExtUtils::MakeMaker or Module::Install.
Presumably newer style Makefile.PL files which use Module::Install or Module::Build already have META.yml files in their distributions.
$parser = new Modile::MakefilePL::Parse( $script );
Parses a Makefile.PL script and returns an object. Returns undef if there is a problem.
undef
$info = $parser->required;
Returns a hash reference containing the prerequisite modules. This is either the the PREREQ_PM key, or a combination of prerequisites specified in requires and build_requires calls in the Makefile.PL script (depending on the "install_type").
PREREQ_PM
requires
build_requires
$module = $parser->install_type;
Returns the module used for installation.
This module does evaluate a portion of the code, so there is a security issue. However, it only evaluates the definition of the PREREQ_PM key in calls to WriteMakefile, which should be more difficult to embed malware in.
WriteMakefile
Do not run this module on untrusted scripts.
These other modules will also provide meta-information about CPAN distributions:
Module::CoreList Module::CPANTS::Generator::Prereq Module::Info Module::Dependency Module::Depends Module::PrintUsed Module::ScanDeps
Note that Module::CPANTS::Generator::Prereq is similar to this module, so it is possible that any future work will be merged into that project than on maintaining this module.
Module::CPANTS::Generator::Prereq
Robert Rothenberg <rrwo at cpan.org>
Copyright (C) 2004 by Robert Rothenbeg. All Rights Reserved.
The test script Module-MakefilePL-Parse.t contains small snippets (less than a few lines) based on existing Makefile.PL files from modules on CPAN. Those modules are acknowledged in the snippets, and the copyrights of those modules belong to their respective authors.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.
To install Module::MakefilePL::Parse, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Module::MakefilePL::Parse
CPAN shell
perl -MCPAN -e shell install Module::MakefilePL::Parse
For more information on module installation, please visit the detailed CPAN module installation guide.