The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Module::MakefilePL::Parse - parse required modules from Makefile.PL

SYNOPSIS

  use Module::MakefilePL::Parse;

  open $fh, 'Makefile.PL';

  $parser = Module::MakefilePL::Parse->new( join("", <$fh>) );

  $info   = $parser->required;

DESCRIPTION

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.

Methods

new
  $parser = new Modile::MakefilePL::Parse( $script );

Parses a Makefile.PL script and returns an object. Returns undef if there is a problem.

required
  $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").

install_type
  $module = $parser->install_type;

Returns the module used for installation.

CAVEATS

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.

Do not run this module on untrusted scripts.

SEE ALSO

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.

AUTHOR

Robert Rothenberg <rrwo at cpan.org>

COPYRIGHT AND LICENSE

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.