blib/lib/Dist/Zilla/Plugin/EnsureMinimumPerl.pm

filter: Statementstmt 100% 21 / 21 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 92.5% 25 / 27 CC 4 SCAR 11.0
CC
4
Cov
96%
before_release
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
↑ Summary
1 package Dist::Zilla::Plugin::EnsureMinimumPerl;
2  
3 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 with qw(
5 Dist::Zilla::Role::BeforeRelease
6 );
7 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 our $VERSION = '0.02';
10  
11 2 ▶sub before_release {
Subroutine before_release: called CC=4 SCAR=13.9
Pod undocumented
12 2 my $self = shift;
13 2 my $prereqs = $self->zilla->prereqs->as_string_hash;
14  
15 2 foreach my $phase (keys %{$prereqs}) {
16 1 foreach my $type (keys %{$prereqs->{$phase}}) {
17 1 my $found = grep { $_ eq 'perl' } keys %{$prereqs->{$phase}{$type}};
18 1 ▶ return if $found;
Branch: 1 branch
BranchTrueFalseTotal
if $found 1 0 1
19 }
20 }
21  
22 1 $self->log_fatal('No minimum required version of Perl specified.');
23 }
24  
25 2 __PACKAGE__->meta->make_immutable;
26 2 1;
27  
28 =head1 NAME
29  
30 Dist::Zilla::Plugin::EnsureMinimumPerl - Ensure that you have specified a minimum version of Perl
31  
32 =head1 SYNOPSIS
33  
34 # In your dist.ini
35 [EnsureMinimumPerl]
36  
37 =head1 DESCRIPTION
38  
39 This C<Dist::Zilla> plugin checks to ensure that you have specified a minimum
40 required version of Perl, before allowing you to perform a release.
41  
42 I kept forgetting to be explicit about this in my own releases, and so I
43 whipped this up to force me to do it.
44  
45 =head1 AUTHOR
46  
47 Graham TerMarsch (cpan@howlingfrog.com)
48  
49 =head1 COPYRIGHT
50  
51 Copyright (C) 2021-, Graham TerMarsch. All Rights Reserved.
52  
53 This is free software; you can redistribute it and/or modify it under the same
54 license as Perl itself.
55  
56 =head1 SEE ALSO
57  
58 =over
59  
60 =item L<Dist::Zilla>
61  
62 =back
63  
64 =cut
↑ Summary