line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Midgen::Role::Output::CPANfile; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
923
|
use constant {NONE => q{}, THREE => 3,}; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
152
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
9
|
use Moo::Role; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
11
|
|
6
|
|
|
|
|
|
|
requires qw( verbose ); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# Load time and dependencies negate execution time |
9
|
|
|
|
|
|
|
# use namespace::clean -except => 'meta'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.33_05'; |
12
|
|
|
|
|
|
|
$VERSION = eval $VERSION; ## no critic |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
5435
|
use English qw( -no_match_vars ); # Avoids reg-ex performance penalty |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
11
|
|
15
|
|
|
|
|
|
|
local $OUTPUT_AUTOFLUSH = 1; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
660
|
use Term::ANSIColor qw( :constants colored ); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
488
|
|
18
|
2
|
|
|
2
|
|
10
|
use File::Spec; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
974
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
####### |
21
|
|
|
|
|
|
|
# header_cpanfile |
22
|
|
|
|
|
|
|
####### |
23
|
|
|
|
|
|
|
sub header_cpanfile { |
24
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
25
|
0
|
|
0
|
|
|
|
my $package_name = shift || NONE; |
26
|
0
|
|
0
|
|
|
|
my $mi_ver = shift || NONE; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
return; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
####### |
32
|
|
|
|
|
|
|
# body_cpanfile |
33
|
|
|
|
|
|
|
####### |
34
|
|
|
|
|
|
|
sub body_cpanfile { |
35
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
36
|
0
|
|
0
|
|
|
|
my $title = shift || return; |
37
|
0
|
|
0
|
|
|
|
my $required_ref = shift || return; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my $pm_length = 0; |
40
|
0
|
|
|
|
|
|
foreach my $module_name (sort keys %{$required_ref}) { |
|
0
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
if (length $module_name > $pm_length) { |
42
|
0
|
|
|
|
|
|
$pm_length = length $module_name; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
0
|
|
|
|
|
if ($title eq 'RuntimeRequires') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
print "\n"; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
$required_ref->{'perl'} = $App::Midgen::Min_Version; |
50
|
0
|
|
|
|
|
|
foreach my $module_name (sort keys %{$required_ref}) { |
|
0
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $mod_name = "'$module_name',"; |
53
|
|
|
|
|
|
|
printf "%s %-*s '%s';\n", 'requires', $pm_length + THREE, $mod_name, |
54
|
|
|
|
|
|
|
$required_ref->{$module_name} |
55
|
0
|
0
|
|
|
|
|
if $required_ref->{$module_name} !~ m/mcpan/; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
elsif ($title eq 'RuntimeRecommends') { |
59
|
0
|
|
|
|
|
|
print "\n"; |
60
|
0
|
|
|
|
|
|
foreach my $module_name (sort keys %{$required_ref}) { |
|
0
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $mod_name = "'$module_name',"; |
63
|
|
|
|
|
|
|
printf "%s %-*s '%s';\n", 'recommends', $pm_length + THREE, $mod_name, |
64
|
|
|
|
|
|
|
$required_ref->{$module_name} |
65
|
0
|
0
|
|
|
|
|
if $required_ref->{$module_name} !~ m/mcpan/; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
elsif ($title eq 'TestRequires') { |
69
|
0
|
|
|
|
|
|
print "\non test => sub {\n"; |
70
|
0
|
|
|
|
|
|
foreach my $module_name (sort keys %{$required_ref}) { |
|
0
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $mod_name = "'$module_name',"; |
72
|
|
|
|
|
|
|
printf "\t%s %-*s '%s';\n", 'requires', $pm_length + THREE, $mod_name, |
73
|
|
|
|
|
|
|
$required_ref->{$module_name} |
74
|
0
|
0
|
|
|
|
|
if $required_ref->{$module_name} !~ m/mcpan/; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
} |
77
|
0
|
0
|
|
|
|
|
print "\n" if %{$required_ref}; |
|
0
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
elsif ($title eq 'TestSuggests') { |
80
|
0
|
|
|
|
|
|
foreach my $module_name (sort keys %{$required_ref}) { |
|
0
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
my $mod_name = "'$module_name',"; |
82
|
|
|
|
|
|
|
printf "\t%s %-*s '%s';\n", 'suggests', $pm_length + THREE, $mod_name, |
83
|
|
|
|
|
|
|
$required_ref->{$module_name} |
84
|
0
|
0
|
|
|
|
|
if $required_ref->{$module_name} !~ m/mcpan/; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
elsif ($title eq 'Close') { |
89
|
0
|
|
|
|
|
|
print "};\n"; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
elsif ($title eq 'DevelopRequires') { |
92
|
0
|
|
|
|
|
|
print "\non develop => sub {\n"; |
93
|
0
|
|
|
|
|
|
foreach my $module_name (sort keys %{$required_ref}) { |
|
0
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
my $mod_name = "'$module_name',"; |
95
|
|
|
|
|
|
|
printf "\t%s %-*s '%s';\n", 'recommends', $pm_length + THREE, |
96
|
|
|
|
|
|
|
$mod_name, $required_ref->{$module_name} |
97
|
0
|
0
|
|
|
|
|
if $required_ref->{$module_name} !~ m/mcpan/; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
} |
100
|
0
|
|
|
|
|
|
print "};\n"; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
return; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
####### |
107
|
|
|
|
|
|
|
# footer_cpanfile |
108
|
|
|
|
|
|
|
####### |
109
|
|
|
|
|
|
|
sub footer_cpanfile { |
110
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
111
|
0
|
|
0
|
|
|
|
my $package_name = shift || NONE; |
112
|
0
|
|
|
|
|
|
$package_name =~ s{::}{-}g; |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
print "\n"; |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
return; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
2
|
|
|
2
|
|
9
|
no Moo; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
12
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
__END__ |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=pod |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=encoding UTF-8 |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 NAME |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
App::Midgen::Role::Output::CPANfile - Output Format - cpanfile, |
133
|
|
|
|
|
|
|
used by L<App::Midgen> |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 VERSION |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
version: 0.33_05 |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 DESCRIPTION |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
The output format uses colour to add visualization of module version number |
142
|
|
|
|
|
|
|
types, be that mcpan, dual-life or added distribution. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 METHODS |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=over 4 |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item * header_cpanfile |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item * body_cpanfile |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item * footer_cpanfile |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=back |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
L<Term::ANSIColor> |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 SEE ALSO |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
L<App::Midgen> |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head1 AUTHOR |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
See L<App::Midgen> |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 CONTRIBUTORS |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
See L<App::Midgen> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 COPYRIGHT |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
See L<App::Midgen> |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 LICENSE |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
179
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=cut |
182
|
|
|
|
|
|
|
|