File Coverage

blib/lib/Dist/Zilla/MVP/Reader/Perl.pm
Criterion Covered Total %
statement 27 28 96.4
branch 6 12 50.0
condition 2 3 66.6
subroutine 5 5 100.0
pod 1 2 50.0
total 41 50 82.0


line stmt bran cond sub pod time code
1             package Dist::Zilla::MVP::Reader::Perl 6.037;
2             # ABSTRACT: the reader for dist.pl files
3              
4 50     50   86909 use Moose;
  50         122  
  50         473  
5             extends 'Config::MVP::Reader';
6             with qw(Config::MVP::Reader::Findable::ByExtension);
7              
8 50     50   372929 use Dist::Zilla::Pragmas;
  50         116  
  50         571  
9              
10 50     50   370 use namespace::autoclean;
  50         135  
  50         615  
11              
12             #pod =head1 DESCRIPTION
13             #pod
14             #pod Dist::Zilla::Config reads in the F<dist.pl> file for a distribution.
15             #pod
16             #pod =cut
17              
18 189     189 0 3552649 sub default_extension { 'pl' }
19              
20             sub read_into_assembler {
21 1     1 1 124 my ($self, $location, $asm) = @_;
22              
23 1         514 my @input = do File::Spec->rel2abs($location);
24 1   66     22 while (@input and ! ref $input[0]) {
25 5         356 my ($key, $value) = (shift(@input), shift(@input));
26 5         36 $asm->add_value($key => $value);
27             }
28              
29 1         95 my $plugins = shift @input;
30              
31 1 50       6 confess "too much input" if @input;
32              
33 1         8 while (my ($ident, $arg) = splice @$plugins, 0, 2) {
34 1 50       4 unless (ref $arg) {
35 1 50       5 unshift @$plugins, $arg if defined $arg;
36 1         5 $arg = [];
37             }
38              
39 1 50       6 my ($moniker, $name) = ref $ident ? @$ident : (($ident) x 2);
40 1         13 $asm->change_section($moniker, $name);
41 1 50       399 my @to_iter = ref $arg eq 'HASH' ? %$arg : @$arg;
42 1         11 while (my ($key, $value) = splice @to_iter, 0, 2) {
43 0         0 $asm->add_value($key, $value);
44             }
45             }
46              
47             # should be done ... elsewhere? -- rjbs, 2009-08-24
48 1 50       4 $asm->end_section if $asm->current_section;
49              
50 1         52 return $asm->sequence;
51             }
52              
53             __PACKAGE__->meta->make_immutable;
54             1;
55              
56             __END__
57              
58             =pod
59              
60             =encoding UTF-8
61              
62             =head1 NAME
63              
64             Dist::Zilla::MVP::Reader::Perl - the reader for dist.pl files
65              
66             =head1 VERSION
67              
68             version 6.037
69              
70             =head1 DESCRIPTION
71              
72             Dist::Zilla::Config reads in the F<dist.pl> file for a distribution.
73              
74             =head1 PERL VERSION
75              
76             This module should work on any version of perl still receiving updates from
77             the Perl 5 Porters. This means it should work on any version of perl
78             released in the last two to three years. (That is, if the most recently
79             released version is v5.40, then this module should work on both v5.40 and
80             v5.38.)
81              
82             Although it may work on older versions of perl, no guarantee is made that the
83             minimum required version will not be increased. The version may be increased
84             for any reason, and there is no promise that patches will be accepted to
85             lower the minimum required perl.
86              
87             =head1 AUTHOR
88              
89             Ricardo SIGNES 😏 <cpan@semiotic.systems>
90              
91             =head1 COPYRIGHT AND LICENSE
92              
93             This software is copyright (c) 2026 by Ricardo SIGNES.
94              
95             This is free software; you can redistribute it and/or modify it under
96             the same terms as the Perl 5 programming language system itself.
97              
98             =cut