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.029;
2             # ABSTRACT: the reader for dist.pl files
3              
4 50     50   92597 use Moose;
  50         233  
  50         426  
5             extends 'Config::MVP::Reader';
6             with qw(Config::MVP::Reader::Findable::ByExtension);
7              
8 50     50   349518 use Dist::Zilla::Pragmas;
  50         143  
  50         402  
9              
10 50     50   438 use namespace::autoclean;
  50         154  
  50         467  
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 3107123 sub default_extension { 'pl' }
19              
20             sub read_into_assembler {
21 1     1 1 122 my ($self, $location, $asm) = @_;
22              
23 1         404 my @input = do File::Spec->rel2abs($location);
24 1   66     12 while (@input and ! ref $input[0]) {
25 5         281 my ($key, $value) = (shift(@input), shift(@input));
26 5         29 $asm->add_value($key => $value);
27             }
28              
29 1         67 my $plugins = shift @input;
30              
31 1 50       5 confess "too much input" if @input;
32              
33 1         6 while (my ($ident, $arg) = splice @$plugins, 0, 2) {
34 1 50       4 unless (ref $arg) {
35 1 50       4 unshift @$plugins, $arg if defined $arg;
36 1         3 $arg = [];
37             }
38              
39 1 50       6 my ($moniker, $name) = ref $ident ? @$ident : (($ident) x 2);
40 1         12 $asm->change_section($moniker, $name);
41 1 50       542 my @to_iter = ref $arg eq 'HASH' ? %$arg : @$arg;
42 1         13 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       6 $asm->end_section if $asm->current_section;
49              
50 1         58 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.029
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 released
78             in the last two to three years. (That is, if the most recently released
79             version is v5.40, then this module should work on both v5.40 and v5.38.)
80              
81             Although it may work on older versions of perl, no guarantee is made that the
82             minimum required version will not be increased. The version may be increased
83             for any reason, and there is no promise that patches will be accepted to lower
84             the minimum required perl.
85              
86             =head1 AUTHOR
87              
88             Ricardo SIGNES 😏 <cpan@semiotic.systems>
89              
90             =head1 COPYRIGHT AND LICENSE
91              
92             This software is copyright (c) 2022 by Ricardo SIGNES.
93              
94             This is free software; you can redistribute it and/or modify it under
95             the same terms as the Perl 5 programming language system itself.
96              
97             =cut