line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
573
|
use 5.006; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
2
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
56
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::MetaProvides::FromFile; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '2.001001'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Pull in hand-crafted metadata from a specified file. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
470
|
use Moose qw( with has around ); |
|
1
|
|
|
|
|
462067
|
|
|
1
|
|
|
|
|
12
|
|
14
|
1
|
|
|
1
|
|
9075
|
use Carp (); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
15
|
1
|
|
|
1
|
|
7
|
use Module::Runtime qw( require_module ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
16
|
1
|
|
|
1
|
|
483
|
use Dist::Zilla::MetaProvides::ProvideRecord; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Dist::Zilla::Util::ConfigDumper qw( config_dumper ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use namespace::autoclean; |
26
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::MetaProvider::Provider'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has file => ( isa => 'Str', is => 'ro', required => 1, ); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
has reader_name => ( isa => 'Str', is => 'ro', default => 'Config::INI::Reader', ); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
has _reader => ( isa => 'Object', is => 'ro', lazy_build => 1, ); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
around dump_config => config_dumper( __PACKAGE__, qw( file reader_name ) ); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
61
|
|
|
|
|
|
|
no Moose; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub provides { |
76
|
|
|
|
|
|
|
my $self = shift; |
77
|
|
|
|
|
|
|
my $conf = $self->_reader->read_file( $self->file ); |
78
|
|
|
|
|
|
|
my $to_record = sub { |
79
|
|
|
|
|
|
|
Dist::Zilla::MetaProvides::ProvideRecord->new( |
80
|
|
|
|
|
|
|
module => $_, |
81
|
|
|
|
|
|
|
file => $conf->{$_}->{file}, |
82
|
|
|
|
|
|
|
version => $conf->{$_}->{version}, |
83
|
|
|
|
|
|
|
parent => $self, |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
}; |
86
|
|
|
|
|
|
|
return map { $to_record->($_) } keys %{$conf}; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub _build__reader { |
96
|
|
|
|
|
|
|
my ($self) = shift; |
97
|
|
|
|
|
|
|
require_module( $self->reader_name ); |
98
|
|
|
|
|
|
|
return $self->reader_name->new(); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__END__ |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=pod |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=encoding UTF-8 |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 NAME |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Dist::Zilla::Plugin::MetaProvides::FromFile - Pull in hand-crafted metadata from a specified file. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 VERSION |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
version 2.001001 |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 SYNOPSIS |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
For a general overview of the C<MetaProvides> family, see |
119
|
|
|
|
|
|
|
L<< Dist::Zilla::Plugin::B<MetaProvides>|Dist::Zilla::Plugin::MetaProvides >> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This module is tailored to the situation where probing various files for C<provides> data is not possible, and you just want to |
122
|
|
|
|
|
|
|
declare some in an external file. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
[MetaProvides::FromFile] |
125
|
|
|
|
|
|
|
inherit_version = 0 ; optional, default = 1 |
126
|
|
|
|
|
|
|
inherit_missing = 0 ; optional, default = 1 |
127
|
|
|
|
|
|
|
file = some_file.ini ; required |
128
|
|
|
|
|
|
|
reader_name = Config::INI::Reader ; optional, default = Config::INI::Reader |
129
|
|
|
|
|
|
|
meta_no_index ; optional, useless |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
And in C<some_file.ini> |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
[Foo::Package] |
134
|
|
|
|
|
|
|
file = some/module/path |
135
|
|
|
|
|
|
|
version = 0.1 |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 OPTION SUMMARY |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 inherit_version |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Shared Logic with all MetaProvides Plugins. See L<Dist::Zilla::Plugin::MetaProvides/inherit_version> |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 inherit_missing |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Shared Logic with all MetaProvides Plugins. See L<Dist::Zilla::Plugin::MetaProvides/inherit_missing> |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 meta_no_index |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Shared Logic with all MetaProvides Plugins. See L<Dist::Zilla::Plugin::MetaProvides/meta_no_index> |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
However, given you're hard-coding the 'provides' map in the source file, and given that parameter |
152
|
|
|
|
|
|
|
is intended to exclude I<discovered> modules from being indexed, it seems like the smart option would |
153
|
|
|
|
|
|
|
be to simply delete the unwanted entries from the source file. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 file |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Mandatory path to a file within your distribution, relative to the distribution root, to extract C<provides> data from. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head2 reader_name |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
A class that can be used to read the named file. Defaults to Config::INI::Reader. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
It can be substituted by any class name that matches the following criteria |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=over 4 |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item * Can be instantiated via C<new> |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
my $instance = $reader_name->new(); |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item * has a C<read_file> method on the instance |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
my $result = $instance->read_file( ... ) |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item * C<read_file> can take the parameter C<file> |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
my $result = $instance->read_file( file => 'path/to/file' ) |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item * C<read_file> returns a hashref matching the following structure |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
{ 'Package::Name' => { |
182
|
|
|
|
|
|
|
file = 'path/to/file', |
183
|
|
|
|
|
|
|
version => '0.1', |
184
|
|
|
|
|
|
|
} } |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=back |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 ROLES |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head2 L<< C<::Role::MetaProvider::Provider>|Dist::Zilla::Role::MetaProvider::Provider >> |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 PLUGIN FIELDS |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head2 file |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head3 type: required, ro, Str |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head2 reader_name |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head3 type: Str, ro. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head3 default: Config::INI::Reader |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head1 PRIVATE PLUGIN FIELDS |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head2 _reader |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head3 type: Object, ro, built from L</reader_name> |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head1 ROLE SATISFYING METHODS |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head2 provides |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
A conformant function to the L<< C<::Role::MetaProvider::Provider>|Dist::Zila::Role::MetaProvider::Provider >> Role. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head3 signature: $plugin->provides() |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head3 returns: Array of L<< C<MetaProvides::ProvideRecord>|Dist::Zilla::MetaProvides::ProvideRecord >> |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=head1 BUILDER METHODS |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 _build__reader |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=head1 SEE ALSO |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=over 4 |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=item * L<< C<[MetaProvides]>|Dist::Zilla::Plugin::MetaProvides >> |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=back |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=head1 AUTHOR |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
Kent Fredric <kentnl@cpan.org> |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Kent Fredric <kentfredric@gmail.com>. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
241
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=cut |