File Coverage

blib/lib/Dist/Zilla/MetaProvides/ProvideRecord.pm
Criterion Covered Total %
statement 27 27 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 1 1 100.0
total 37 37 100.0


line stmt bran cond sub pod time code
1 8     8   8454860 use 5.006;
  8         21  
2 8     8   29 use strict;
  8         12  
  8         141  
3 8     8   32 use warnings;
  8         11  
  8         417  
4              
5             package Dist::Zilla::MetaProvides::ProvideRecord;
6              
7             our $VERSION = '2.002004';
8              
9             # ABSTRACT: Data Management Record for MetaProvider::Provides Based Class
10              
11             our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
12              
13 8     8   981 use Moose qw( has );
  8         583136  
  8         41  
14 8     8   28224 use MooseX::Types::Moose qw( Str );
  8         154678  
  8         72  
15 8     8   27841 use Dist::Zilla::MetaProvides::Types qw( ModVersion ProviderObject );
  8         15  
  8         29  
16              
17 8     8   5661 use namespace::autoclean;
  8         10  
  8         48  
18              
19              
20              
21              
22              
23              
24              
25              
26              
27              
28              
29              
30              
31              
32              
33              
34              
35              
36              
37             has version => ( isa => ModVersion, is => 'ro', required => 1 );
38              
39              
40              
41              
42              
43              
44              
45              
46             has module => ( isa => Str, is => 'ro', required => 1 );
47              
48              
49              
50              
51              
52              
53              
54             has file => ( isa => Str, is => 'ro', required => 1 );
55              
56              
57              
58              
59              
60              
61              
62              
63             has parent => (
64             is => 'ro',
65             required => 1,
66             weak_ref => 1,
67             isa => ProviderObject,
68             handles => [ 'zilla', '_resolve_version', ],
69             );
70              
71             __PACKAGE__->meta->make_immutable;
72 8     8   863 no Moose;
  8         10  
  8         38  
73              
74              
75              
76              
77              
78              
79              
80              
81              
82              
83              
84              
85              
86              
87              
88              
89              
90              
91             sub copy_into {
92 8     8 1 1191 my $self = shift;
93 8         11 my $dlist = shift;
94 8         259 $dlist->{ $self->module } = {
95             file => $self->file,
96             $self->_resolve_version( $self->version ),
97             };
98 8         57 return 1;
99             }
100              
101             1;
102              
103             __END__
104              
105             =pod
106              
107             =encoding UTF-8
108              
109             =head1 NAME
110              
111             Dist::Zilla::MetaProvides::ProvideRecord - Data Management Record for MetaProvider::Provides Based Class
112              
113             =head1 VERSION
114              
115             version 2.002004
116              
117             =head1 PUBLIC METHODS
118              
119             =head2 copy_into C<( \%provides_list )>
120              
121             Populate the referenced C<%provides_list> with data from this Provide Record object.
122              
123             This is called by the L<Dist::Zilla::Role::MetaProvider::Provider> Role.
124              
125             This is very convenient if you have an array full of these objects, for you can just do
126              
127             my %discovered;
128             for ( @array ) {
129             $_->copy_into( \%discovered );
130             }
131              
132             and C<%discovered> will be populated with relevant data.
133              
134             =head1 ATTRIBUTES / PARAMETERS
135              
136             =head2 version
137              
138             See L<Dist::Zilla::MetaProvides::Types/ModVersion>
139              
140             =head2 module
141              
142             The String Name of a fully qualified module to be reported as
143             included in the distribution.
144              
145             =head2 file
146              
147             The String Name of the file as to be reported in the distribution.
148              
149             =head2 parent
150              
151             A L<Dist::Zilla::MetaProvides::Types/ProviderObject>, mostly to get Zilla information
152             and accessors from L<Dist::Zilla::Role::MetaProvider::Provider>
153              
154             =begin MetaPOD::JSON v1.1.0
155              
156             {
157             "namespace":"Dist::Zilla::MetaProvides::ProvideRecord",
158             "interface":"class",
159             "inherits":"Moose::Object"
160             }
161              
162              
163             =end MetaPOD::JSON
164              
165             =head1 AUTHOR
166              
167             Kent Fredric <kentnl@cpan.org>
168              
169             =head1 COPYRIGHT AND LICENSE
170              
171             This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>.
172              
173             This is free software; you can redistribute it and/or modify it under
174             the same terms as the Perl 5 programming language system itself.
175              
176             =cut