App-CamelPKI
view release on metacpan or search on metacpan
t/maintainer/dependencies.t view on Meta::CPAN
#!perl -w
use strict;
use warnings;
=head1 NAME
dependencies.t - Checks that B<Build.PL> lists all required CPAN modules.
=head1 DESCRIPTION
This test looks at the dependencies listed in the C<requires> keys in
B<Build.PL>, and matches them against the actual run-time dependencies
of the distribution's codebase. It then combines the dependencies
listed in the C<requires> and C<build_requires> keys, and matches them
against the actual compile-time dependencies. If any module is listed
in C<Build.PL> and not an actual dependency or vice versa (barring a
well-known list of false positives and "pervasive" modules), the test
fails.
This tests uses L<Module::ScanDeps>, whose guts it rearranges in a
creative fashion so as to eliminate most false positives and be able
to pinpoint lines of source code in case the test fails. This results
in a somewhat quirky implementation, but OTOH this test is only
intended for running on the maintainer's system.
=cut
BEGIN {
my $errors;
foreach my $use (qw(Test::More File::Spec File::Slurp
File::Find Module::ScanDeps IO::File)) {
$errors .= $@ unless eval "use $use; 1";
}
if ($errors) {
plan(skip_all => "Some modules are missing "
. "in order to run this test");
warn $errors if $ENV{DEBUG};
exit;
}
}
plan tests => 3;
=pod
=head1 TWEAKABLES
=head2 %is_subpackage_of
A hash table that associates dependent packages
(e.g. C<DBIx::Class::Schema>, C<Catalyst::Controller>) to the
canonical top-level package in their distribution
(e.g. C<DBIx::Class>, C<Catalyst>). Requirements and dependencies
that name a key in %is_subpackage_of will be treated as though they
were the corresponding value instead.
=cut
# FIXME: use Module::Depends or some such to compute this
# automatically.
our %is_subpackage_of =
( "Catalyst::Controller" => "Catalyst",
"Catalyst::View" => "Catalyst",
"Catalyst::Model" => "Catalyst",
"Catalyst::Runtime" => "Catalyst",
"Catalyst::Utils" => "Catalyst",
"Catalyst::Action" => "Catalyst",
"Catalyst::Test" => "Catalyst",
"DBIx::Class::Schema" => "DBIx::Class",
"DateTime::Duration" => "DateTime",
);
( run in 0.778 second using v1.01-cache-2.11-cpan-5b529ec07f3 )