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