NAME
Test::CPAN::Health::Check::MinPerl - Check that a minimum Perl version is declared and accurate
SYNOPSIS
use Test::CPAN::Health::Check::MinPerl;
my $check = Test::CPAN::Health::Check::MinPerl->new;
my $result = $check->run($dist);
printf "%s: %s\n", $result->status, $result->summary;
DESCRIPTION
Checks two things:
The distribution declares
requires perl => 'X.Y'in its runtime prerequisites (readable via META).If Perl::MinimumVersion is available, it scans all
.pmand.plsource files and confirms the declared minimum is not lower than what the source code actually requires.
Score matrix:
100 -- Declared, and verified to match or exceed detected minimum.
80 -- Declared, but
Perl::MinimumVersionunavailable to verify.40 -- Declared minimum is lower than detected source minimum (underdeclared).
0 -- No minimum Perl version declared.
skip -- No META file found.
LIMITATIONS
Perl::MinimumVersionis an optional dependency; the check degrades gracefully to score 80 when it is absent.Only
runtime.requires.perlis inspected. A constraint inconfigure.requiresorbuild.requiresis ignored.
run
PURPOSE
Inspect prereqs.runtime.requires.perl in META and, when Perl::MinimumVersion is available, verify it against the actual source code.
API SPECIFICATION
INPUT
dist Test::CPAN::Health::Distribution required
context Hashref optional prior check results
OUTPUT
Test::CPAN::Health::Result with check_id 'min_perl'.
MESSAGES
Code | Severity | Message | Resolution
------+----------+------------------------------------------------+-----------
MP001 | SKIP | No META file | Add META file
MP002 | FAIL | No min Perl version declared in prereqs | Add requires perl
MP003 | PASS | Declared; Perl::MinimumVersion unavailable |
MP004 | WARN | Declared minimum lower than detected minimum | Raise declared minimum
MP005 | PASS | Declared minimum verified against source code |
FORMAL SPECIFICATION
-- Z schema (placeholder) --
MinPerlOp
dist : Distribution
declared : String | undefined
detected : version | undefined
-------------------------------------------------------
meta = undefined => status = skip
declared = undefined => status = fail /\ score = 0
detected = undefined => status = pass /\ score = 80
declared_v < detected => status = warn /\ score = 40
declared_v >= detected => status = pass /\ score = 100
SIDE EFFECTS
May invoke Perl::MinimumVersion on all source files, which performs PPI parsing (CPU-intensive for large distributions).
USAGE EXAMPLE
my $result = Test::CPAN::Health::Check::MinPerl->new->run($dist);
print $result->summary;
AUTHOR
Nigel Horne, <njh at nigelhorne.com>
LICENSE AND COPYRIGHT
Copyright (C) 2025-2026 Nigel Horne.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.