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