line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
2121823
|
use 5.006; # 06 => our , pragmas 04 => __PACKAGE__ |
|
2
|
|
|
|
|
6
|
|
2
|
2
|
|
|
2
|
|
7
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
41
|
|
3
|
2
|
|
|
2
|
|
14
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
141
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::MetaProvides::Class; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '2.001001'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Scans Dist::Zilla's .pm files and tries to identify classes using Class::Discover. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
516
|
use Moose qw( has with ); |
|
2
|
|
|
|
|
323959
|
|
|
2
|
|
|
|
|
14
|
|
14
|
2
|
|
|
2
|
|
8597
|
use Class::Discover (); |
|
2
|
|
|
|
|
376256
|
|
|
2
|
|
|
|
|
53
|
|
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
956
|
use Dist::Zilla::MetaProvides::ProvideRecord 2.000000; |
|
2
|
|
|
|
|
189358
|
|
|
2
|
|
|
|
|
107
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
2
|
|
19
|
use namespace::autoclean; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
15
|
|
27
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::MetaProvider::Provider'; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has '+meta_noindex' => ( default => sub { 1 } ); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub provides { |
66
|
3
|
|
|
3
|
1
|
65940
|
my $self = shift; |
67
|
|
|
|
|
|
|
my $perl_module = sub { |
68
|
|
|
|
|
|
|
## no critic ( RegularExpressions ) |
69
|
6
|
|
|
6
|
|
16
|
$_->name =~ m{^lib[/].*[.](pm|pod)$}; |
70
|
3
|
|
|
|
|
13
|
}; |
71
|
|
|
|
|
|
|
my $get_records = sub { |
72
|
3
|
|
|
3
|
|
8
|
$self->_classes_for( $_->name, $_->content ); |
73
|
3
|
|
|
|
|
11
|
}; |
74
|
|
|
|
|
|
|
|
75
|
3
|
|
|
|
|
6
|
my (@files) = @{ $self->zilla->files }; |
|
3
|
|
|
|
|
78
|
|
76
|
|
|
|
|
|
|
|
77
|
3
|
|
|
|
|
77
|
my (@records) = map { $get_records->()} grep {$perl_module->()} @files; |
|
3
|
|
|
|
|
93
|
|
|
6
|
|
|
|
|
114
|
|
78
|
|
|
|
|
|
|
|
79
|
3
|
|
|
|
|
427
|
return $self->_apply_meta_noindex(@records); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub _classes_for { |
93
|
3
|
|
|
3
|
|
920
|
my ( $self, $filename, $content ) = @_; |
94
|
3
|
|
|
|
|
21
|
my ($scanparams) = { |
95
|
|
|
|
|
|
|
keywords => { class => 1, role => 1, }, |
96
|
|
|
|
|
|
|
files => [$filename], |
97
|
|
|
|
|
|
|
file => $filename, |
98
|
|
|
|
|
|
|
}; |
99
|
|
|
|
|
|
|
my $to_record = sub { |
100
|
|
|
|
|
|
|
Dist::Zilla::MetaProvides::ProvideRecord->new( |
101
|
6
|
|
|
|
|
24
|
module => [ keys %{$_} ]->[0], |
102
|
|
|
|
|
|
|
file => $filename, |
103
|
6
|
|
|
|
|
221
|
version => [ values %{$_} ]->[0]->{version}, |
104
|
6
|
|
|
6
|
|
8
|
parent => $self, |
105
|
|
|
|
|
|
|
); |
106
|
3
|
|
|
|
|
12
|
}; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# I'm being bad and using a private function, but meh. |
109
|
|
|
|
|
|
|
# We know this is bad :( |
110
|
|
|
|
|
|
|
## no critic ( ProtectPrivateSubs ) |
111
|
3
|
|
|
|
|
26
|
return map { $to_record->() } Class::Discover->_search_for_classes_in_file( $scanparams, \$content ); |
|
6
|
|
|
|
|
12905
|
|
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
125
|
2
|
|
|
2
|
|
776
|
no Moose; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
14
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
1; |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
__END__ |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=pod |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=encoding UTF-8 |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 NAME |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Dist::Zilla::Plugin::MetaProvides::Class - Scans Dist::Zilla's .pm files and tries to identify classes using Class::Discover. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 VERSION |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
version 2.001001 |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 SYNOPSIS |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
[MetaProvides::Class] |
146
|
|
|
|
|
|
|
meta_noindex = 1 ; default > See :MetaProvider::Provider |
147
|
|
|
|
|
|
|
inherit_version = 1 ; default > See :MetaProvider::Provider |
148
|
|
|
|
|
|
|
inherit_missing = 1 ; default > See :MetaProvider::Provider |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 ROLES |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 C<::MetaProvider::Provider> |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
L<< C<â Dist::Zilla::Role::MetaProvider::Provider>|Dist::Zilla::Role::MetaProvider::Provider >> |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head3 C<meta_noindex> |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Extended from L<< C<MetaProvider::Provider>|Dist::Zilla::Role::MetaProvider::Provider/meta_noindex >> |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
This is a utility for people who are also using L<< C<MetaNoIndex>|Dist::Zilla::Plugin::MetaNoIndex >>, |
161
|
|
|
|
|
|
|
so that its settings can be used to eliminate items from the 'provides' list. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=over 4 |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item * meta_noindex = 0 |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
By default, do nothing unusual. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item * DEFAULT: meta_noindex = 1 |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
When a module meets the criteria provided to L<< C<MetaNoIndex>|Dist::Zilla::Plugin::MetaNoIndex >>, |
172
|
|
|
|
|
|
|
eliminate it from the metadata shipped to L<< C<Dist::Zilla>|Dist::Zilla >> |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=back |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 ROLE SATISFYING METHODS |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head2 provides |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
A conformant function to the L<< C<::MetaProvider::Provider>|Dist::Zilla::Role::MetaProvider::Provider >> Role. |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head3 signature: $plugin->provides() |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head3 returns: Array of L<< C<:MetaProvides::ProvideRecord>|Dist::Zilla::MetaProvides::ProvideRecord >> |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head1 PRIVATE METHODS |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head2 _classes_for |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head3 signature: $plugin->_classes_for( $filename, $file_content ) |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head3 returns: Array of L<< C<:MetaProvides::ProvideRecord>|Dist::Zilla::MetaProvides::ProvideRecord >> |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head1 SEE ALSO |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=over 4 |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item * L<< C<[MetaProvides]>|Dist::Zilla::Plugin::MetaProvides >> |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=back |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 AUTHOR |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Kent Fredric <kentnl@cpan.org> |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>. |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
211
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=cut |