line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Dzpl::Parser; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
81241
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
79
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
111
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
2092
|
use Dist::Zilla; |
|
2
|
|
|
|
|
2810742
|
|
|
2
|
|
|
|
|
104
|
|
7
|
2
|
|
|
2
|
|
2282
|
use Dist::Zilla::Chrome::Term; |
|
2
|
|
|
|
|
106876
|
|
|
2
|
|
|
|
|
85
|
|
8
|
2
|
|
|
2
|
|
23
|
use Dist::Zilla::Util; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
76
|
|
9
|
2
|
|
|
2
|
|
13
|
use Class::MOP; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
43
|
|
10
|
2
|
|
|
2
|
|
10
|
use Moose::Autobox; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
25
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub parse { |
13
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
3
|
my ( %zilla, @prerequisite ); |
16
|
1
|
|
|
|
|
6
|
while( @_ ) { |
17
|
5
|
|
|
|
|
10
|
local $_ = shift; |
18
|
5
|
100
|
|
|
|
42
|
if ( m/\A(?:authors?|by)\z/ ) { $self->_parse_author( \%zilla, shift ) } |
|
1
|
100
|
|
|
|
25
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
19
|
1
|
|
|
|
|
17
|
elsif ( m/\Acopyright\z/) { $self->_parse_copyright( \%zilla => shift ) } |
20
|
1
|
|
|
|
|
12
|
elsif ( m/\Alicense\z/) { $self->_parse_license( \%zilla => shift ) } |
21
|
0
|
|
|
|
|
0
|
elsif ( m/\Arequire\z/) { $self->_parse_prerequisite( \@prerequisite => require => shift ) } |
22
|
0
|
|
|
|
|
0
|
elsif ( m/\Arecommend\z/) { $self->_parse_prerequisite( \@prerequisite => recommend => shift ) } |
23
|
0
|
|
|
|
|
0
|
elsif ( m/\Aprefer\z/) { $self->_parse_prerequisite( \@prerequisite => prefer => shift ) } |
24
|
2
|
|
|
|
|
8
|
else { $zilla{$_} = shift } |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
33
|
|
|
71
|
$zilla{ chrome } ||= Dist::Zilla::Chrome::Term->new; |
28
|
1
|
|
50
|
|
|
47
|
$zilla{ root } ||= '.'; |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
46
|
my $zilla = Dist::Zilla->new( %zilla ); |
31
|
1
|
|
|
|
|
2132
|
for my $prerequisite (@prerequisite) { |
32
|
0
|
|
|
|
|
0
|
my ( $phase, $type, $manifest ) = @$prerequisite{qw/ phase type manifest /}; |
33
|
0
|
|
|
|
|
0
|
$phase = lc $phase; |
34
|
0
|
|
|
|
|
0
|
$type = "${type}s"; |
35
|
0
|
|
|
|
|
0
|
$zilla->register_prereqs( { phase => $phase, type => $type }, @$manifest ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
6
|
return $zilla; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _parse_prerequisite { |
42
|
6
|
|
|
6
|
|
16085
|
my $self = shift; |
43
|
6
|
|
|
|
|
7
|
my $stash = shift; |
44
|
6
|
|
|
|
|
8
|
my $importance = shift; |
45
|
6
|
|
|
|
|
9
|
my $input = shift; |
46
|
|
|
|
|
|
|
|
47
|
6
|
50
|
33
|
|
|
36
|
die "Missing input" unless defined $input && length $input; |
48
|
|
|
|
|
|
|
|
49
|
6
|
|
|
|
|
6
|
my @stash; |
50
|
6
|
|
|
|
|
10
|
my $manifest = []; |
51
|
6
|
|
|
|
|
19
|
push @stash, { phase => 'runtime', type => $importance, manifest => $manifest }; |
52
|
6
|
|
|
|
|
20
|
for my $line ( split m/\n/, $input ) { |
53
|
21
|
|
|
|
|
122
|
s/^\s*//, s/\s*$// for $line; |
54
|
21
|
100
|
66
|
|
|
104
|
next if $line =~ m/^#/ || $line !~ m/\S/; |
55
|
18
|
100
|
66
|
|
|
153
|
if ( |
56
|
|
|
|
|
|
|
$line =~ m/\A\@([\w\-]+):\z/ || # @Test: |
57
|
|
|
|
|
|
|
$line =~ m/\A\[([\w\-]+)\]\z/ # [Test] |
58
|
|
|
|
|
|
|
) { |
59
|
9
|
|
|
|
|
42
|
push @stash, { phase => lc $1, type => $importance, manifest => ( $manifest = [] ) }; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
else { |
62
|
9
|
|
|
|
|
39
|
my ( $package, $version ) = split m/\s+/, $line, 2; |
63
|
9
|
50
|
|
|
|
19
|
$package = $line unless defined $package; |
64
|
9
|
|
100
|
|
|
25
|
$version ||= 0; |
65
|
9
|
|
|
|
|
25
|
push @$manifest, ( $package => $version ); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
6
|
|
|
|
|
13
|
push @$stash, grep { @{ $_->{manifest} } > 0 } @stash; |
|
15
|
|
|
|
|
14
|
|
|
15
|
|
|
|
|
179
|
|
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub _parse_author { |
73
|
2
|
|
|
2
|
|
1118
|
my $self = shift; |
74
|
2
|
|
|
|
|
4
|
my $zilla = shift; |
75
|
2
|
|
|
|
|
5
|
my $input = shift; |
76
|
|
|
|
|
|
|
|
77
|
2
|
|
|
|
|
3
|
my @author; |
78
|
2
|
50
|
|
|
|
239
|
if ( ref $input eq 'ARRAY' ) { |
|
|
100
|
|
|
|
|
|
79
|
0
|
|
|
|
|
0
|
@author = @$input; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
elsif ( $input =~ m/\n/ ) { |
82
|
1
|
|
|
|
|
6
|
for my $line ( split m/\n/, $input ) { |
83
|
4
|
|
|
|
|
6
|
local $_ = $line; |
84
|
4
|
100
|
|
|
|
12
|
next unless m/\S/; |
85
|
2
|
|
|
|
|
15
|
$line =~ s/^\s*//, s/\s*$//; |
86
|
2
|
|
|
|
|
6
|
push @author, $line; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
else { |
90
|
1
|
|
|
|
|
4
|
@author = ($input); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
2
|
|
|
|
|
12
|
$zilla->{authors} = \@author; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub _parse_copyright { |
97
|
4
|
|
|
4
|
|
7964
|
my $self = shift; |
98
|
4
|
|
|
|
|
8
|
my $zilla = shift; |
99
|
4
|
|
|
|
|
7
|
my $input = shift; |
100
|
|
|
|
|
|
|
|
101
|
4
|
100
|
|
|
|
21
|
if ( $input =~ m/\A\s*(\d{4})\s+(.+?)\s*\z/ ) { |
102
|
2
|
|
|
|
|
7
|
$zilla->{copyright_year} = $1; |
103
|
2
|
|
|
|
|
7
|
$zilla->{copyright_holder} = $2; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
else { |
106
|
2
|
|
|
|
|
10
|
$zilla->{copyright_holder} = $input; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub _parse_license { |
111
|
4
|
|
|
4
|
|
16607
|
my $self = shift; |
112
|
4
|
|
|
|
|
9
|
my $zilla = shift; |
113
|
4
|
|
|
|
|
10
|
my $input = shift; |
114
|
|
|
|
|
|
|
|
115
|
4
|
|
|
|
|
8
|
my $license = $input; |
116
|
4
|
50
|
|
|
|
28
|
if ( $license =~ m/\APerl[\-_]?5/ ) { |
117
|
4
|
|
|
|
|
8
|
$license = 'Perl_5'; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
4
|
|
|
|
|
17
|
$zilla->{license} = $license; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; |
125
|
|
|
|
|
|
|
|