Dist::Requires - Identify prerequisites for a distribution
version 0.008
use Dist::Requires;
my $dr = Dist::Requires->new();
# From a packed distribution archive file...
my %prereqs = $dr->prerequisites(dist => 'Foo-Bar-1.2.tar.gz');
# From an unpacked distribution directory...
my %prereqs = $dr->prerequisites(dist => 'Foo-Bar-1.2');
Dist::Requires reports the packages (and their versions) that are required to configure, test, build, and install a distribution. The distribution may be either a packed distribution archive or an unpacked distribution directory. By default, the results will exclude requirements that are satisfied by the perl core.
Dist::Requires is intended for discovering requirements in the same manner and context that cpan and cpanm do it. It is specifically designed to support Pinto, so I don't expect this module to be useful to you unless you are doing something that deals directly with the CPAN toolchain.
Dist::Requires does not recurse into dependencies, it does
not scan source files for packages that you use
or require
,
it does not search for distribution metadata on CPAN, and it does
not generate pretty graphs. If you need those things, please
["SEE ALSO"](#SEE ALSO).
All of the attributes listed below can be set via the constructor, and retrieved via accessor methods by the same name. Once constructed, the object is immutable and all attributes are read-only.
The path to the perl executable that will be used to configure the distribution. Defaults to the perl that loaded this module. NOTE: this attribute is not configurable at this time.
The core module list for the specified perl version will be used to
filter the requirements. This only matters if you're using the
default package filter. Defaults to the version of the perl specified
by the perl
attribute. Can be specified as a decimal number, a
dotted version string, or a version object.
Sets the timeout (in seconds) for running the distribution's configuration step. Defaults to 30 seconds.
Given a hashref of MODULE_NAME => VERSION pairs, any distribution
requirements that have the same version or less than those listed in
the hashref will be excluded from the output. This defaults to the
modules and versions reported by Module::CoreList for the version
of perl that was specified by the target_perl_version
attribute.
If you don't want any filter to be applied, then just give a reference
to any empty hash.
Returns the requirements of the distribution as a hash of PACKAGE_NAME
=> VERSION pairs. The dist
argument can be the path to either a
distribution archive file (e.g. Foo-Bar-1.2.tar.gz
) or an unpacked
distribution directory (e.g. Foo-Bar-1.2
). The requirements will
be filtered according to the values specified by the filter
attribute.
Dist::Requires will attempt to configure the distribution using whatever build mechanism it provides (e.g. Module::Build or ExtUtils::MakeMaker or Module::Install) and then extract the requirements from the resulting metadata files. That means you could be executing unsafe code. However, this is no different from what cpanm and cpan do when you install a distribution.
Neil Bowers has written an excellent comparison of various modules for finding dependencies here.
You can find documentation for this module with the perldoc command.
perldoc Dist::Requires
The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.
- Search CPAN
The default CPAN search engine, useful to view POD in HTML format.
http://search.cpan.org/dist/Dist-Requires
- CPAN Ratings
The CPAN Ratings is a website that allows community ratings and reviews of Perl modules.
http://cpanratings.perl.org/d/Dist-Requires
- CPAN Testers
The CPAN Testers is a network of smokers who run automated tests on uploaded CPAN distributions.
http://www.cpantesters.org/distro/D/Dist-Requires
- CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
http://matrix.cpantesters.org/?dist=Dist-Requires
- CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
http://deps.cpantesters.org/?module=Dist::Requires
https://github.com/thaljef/Dist-Requires/issues
https://github.com/thaljef/Dist-Requires
git clone git://github.com/thaljef/Dist-Requires.git
Jeffrey Ryan Thalhammer [email protected]
This software is copyright (c) 2011 by Imaginative Software Systems.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.