File Coverage

blib/lib/Dist/Zilla/Plugin/FinderCode.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 0 1 0.0
total 30 31 96.7


line stmt bran cond sub pod time code
1             # ABSTRACT: a callback-based FileFinder plugin
2              
3             use Moose;
4 49     49   1701 with 'Dist::Zilla::Role::FileFinder';
  49         144  
  49         453  
5              
6             use Dist::Zilla::Pragmas;
7 49     49   346619  
  49         139  
  49         469  
8             use namespace::autoclean;
9 49     49   396  
  49         135  
  49         521  
10             use Moose::Util::TypeConstraints;
11 49     49   4666  
  49         178  
  49         645  
12             has code => (
13             is => 'ro',
14             isa => 'CodeRef',
15             required => 1,
16             );
17              
18             has style => (
19             is => 'ro',
20             isa => enum([ qw(grep list) ]),
21             required => 1,
22             );
23              
24             my ($self) = @_;
25              
26 225     225 0 610 my $method = '_find_via_' . $self->style;
27              
28 225         7424 $self->$method;
29             }
30 225         1053  
31             my ($self) = @_;
32              
33             my @files = grep { $self->code->($_, $self) } @{ $self->zilla->files };
34 126     126   347 return \@files;
35             }
36 126         433  
  788         21763  
  126         3667  
37 126         734 my ($self) = @_;
38              
39             my $code = $self->code;
40             $self->$code;
41 99     99   315 }
42              
43 99         2911 __PACKAGE__->meta->make_immutable;
44 99         454 1;
45              
46              
47             =pod
48              
49             =encoding UTF-8
50              
51             =head1 NAME
52              
53             Dist::Zilla::Plugin::FinderCode - a callback-based FileFinder plugin
54              
55             =head1 VERSION
56              
57             version 6.028
58              
59             =head1 PERL VERSION
60              
61             This module should work on any version of perl still receiving updates from
62             the Perl 5 Porters. This means it should work on any version of perl released
63             in the last two to three years. (That is, if the most recently released
64             version is v5.40, then this module should work on both v5.40 and v5.38.)
65              
66             Although it may work on older versions of perl, no guarantee is made that the
67             minimum required version will not be increased. The version may be increased
68             for any reason, and there is no promise that patches will be accepted to lower
69             the minimum required perl.
70              
71             =head1 AUTHOR
72              
73             Ricardo SIGNES 😏 <cpan@semiotic.systems>
74              
75             =head1 COPYRIGHT AND LICENSE
76              
77             This software is copyright (c) 2022 by Ricardo SIGNES.
78              
79             This is free software; you can redistribute it and/or modify it under
80             the same terms as the Perl 5 programming language system itself.
81              
82             =cut