line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::Coverage::Moose; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Pod::Coverage::Moose::VERSION = '0.05'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# git description: v0.04-19-g4edd882 |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
8
|
3
|
|
|
3
|
|
13630
|
$Pod::Coverage::Moose::AUTHORITY = 'cpan:ETHER'; |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
# ABSTRACT: Pod::Coverage extension for Moose |
11
|
3
|
|
|
3
|
|
2453
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Pod::Coverage; |
14
|
|
|
|
|
|
|
use Carp qw( croak ); |
15
|
|
|
|
|
|
|
use Class::Load qw( load_class ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use namespace::autoclean; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has package => ( |
22
|
|
|
|
|
|
|
is => 'rw', |
23
|
|
|
|
|
|
|
isa => 'Str', |
24
|
|
|
|
|
|
|
required => 1, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has cover_requires => ( |
29
|
|
|
|
|
|
|
is => 'ro', |
30
|
|
|
|
|
|
|
isa => 'Bool', |
31
|
|
|
|
|
|
|
default => 0, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# |
35
|
|
|
|
|
|
|
# original pod_coverage object |
36
|
|
|
|
|
|
|
# |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has _pod_coverage => ( |
39
|
|
|
|
|
|
|
is => 'rw', |
40
|
|
|
|
|
|
|
isa => 'Pod::Coverage', |
41
|
|
|
|
|
|
|
handles => [qw( coverage why_unrated naked uncovered covered )], |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my %is = map { $_ => 1 } qw( rw ro wo ); |
46
|
|
|
|
|
|
|
sub BUILD { |
47
|
|
|
|
|
|
|
my ($self, $args) = @_; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $meta = $self->package->meta; |
50
|
|
|
|
|
|
|
my @trustme = @{ $args->{trustme} || [] }; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
push @trustme, qr/^meta$/; |
53
|
|
|
|
|
|
|
push @trustme, # MooseX-AttributeHelpers hack |
54
|
|
|
|
|
|
|
map { qr/^$_$/ } |
55
|
|
|
|
|
|
|
map { $_->name } |
56
|
|
|
|
|
|
|
grep { $_->isa('MooseX::AttributeHelpers::Meta::Method::Provided') } |
57
|
|
|
|
|
|
|
$meta->get_all_methods |
58
|
|
|
|
|
|
|
unless $meta->isa('Moose::Meta::Role'); |
59
|
|
|
|
|
|
|
push @trustme, |
60
|
|
|
|
|
|
|
map { qr/^\Q$_\E$/ } # turn value into a regex |
61
|
|
|
|
|
|
|
map { # iterate over all roles of the class |
62
|
|
|
|
|
|
|
my $role = $_; |
63
|
|
|
|
|
|
|
$role->get_method_list, |
64
|
|
|
|
|
|
|
($self->cover_requires ? ($role->get_required_method_list) : ()), |
65
|
|
|
|
|
|
|
map { # iterate over attributes |
66
|
|
|
|
|
|
|
my $attr = $role->get_attribute($_); |
67
|
|
|
|
|
|
|
($attr->{is} && $is{$attr->{is}} ? $_ : ()), # accessors |
68
|
|
|
|
|
|
|
grep defined, map { $attr->{ $_ } } # other attribute methods |
69
|
|
|
|
|
|
|
qw( clearer predicate reader writer accessor ); |
70
|
|
|
|
|
|
|
} $role->get_attribute_list, |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
$meta->calculate_all_roles; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
$args->{trustme} = \@trustme; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$self->_pod_coverage(Pod::Coverage->new(%$args)); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
around new => sub { |
81
|
|
|
|
|
|
|
my $next = shift; |
82
|
|
|
|
|
|
|
my ($self, @args) = @_; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my %args = (@args == 1 && ref $args[0] eq 'HASH' ? %{ $args[0] } : @args); |
85
|
|
|
|
|
|
|
my $class = $args{package} |
86
|
|
|
|
|
|
|
or croak 'You need to specify a package in the constructor arguments'; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
load_class($class); |
89
|
|
|
|
|
|
|
return Pod::Coverage->new(%args) unless $class->can('meta'); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
return $self->$next(@args); |
92
|
|
|
|
|
|
|
}; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__ |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=pod |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=encoding UTF-8 |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=for :stopwords Robert 'phaylon' Sedlacek Dave Rolsky Karen Etheridge Vyacheslav Matyukhin |
103
|
|
|
|
|
|
|
initialises |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 NAME |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Pod::Coverage::Moose - Pod::Coverage extension for Moose |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 VERSION |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
version 0.05 |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 SYNOPSIS |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
use Pod::Coverage::Moose; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
my $pcm = Pod::Coverage::Moose->new(package => 'MoosePackage'); |
118
|
|
|
|
|
|
|
print 'Coverage: ', $pcm->coverage, "\n"; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 DESCRIPTION |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
When using L<Pod::Coverage> in combination with L<Moose>, it will |
123
|
|
|
|
|
|
|
report any method imported from a Role. This is especially bad when |
124
|
|
|
|
|
|
|
used in combination with L<Test::Pod::Coverage>, since it takes away |
125
|
|
|
|
|
|
|
its ease of use. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
To use this module in combination with L<Test::Pod::Coverage>, use |
128
|
|
|
|
|
|
|
something like this: |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
use Test::Pod::Coverage; |
131
|
|
|
|
|
|
|
all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::Moose'}); |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 package |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This is the package used for inspection. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 cover_requires |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Boolean flag to indicate that C<requires $method> declarations in a Role should be trusted. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 METHODS |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 meta |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
L<Moose> meta object. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 BUILD |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Initialises the internal L<Pod::Coverage> object. It uses the meta object |
152
|
|
|
|
|
|
|
to find all methods and attribute methods imported via roles. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 DELEGATED METHODS |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head2 Delegated to the traditional L<Pod::Coverage> object are |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=over |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item coverage |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=item covered |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item naked |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=item uncovered |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item why_unrated |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=back |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 EXTENDED METHODS |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head2 new |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
The constructor will only return a C<Pod::Coverage::Moose> object if it |
177
|
|
|
|
|
|
|
is invoked on a class that C<can> a C<meta> method. Otherwise, a |
178
|
|
|
|
|
|
|
traditional L<Pod::Coverage> object will be returned. This is done so you |
179
|
|
|
|
|
|
|
don't get in trouble for mixing L<Moose> with non Moose classes in your |
180
|
|
|
|
|
|
|
project. |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 SEE ALSO |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
L<Moose>, |
185
|
|
|
|
|
|
|
L<Pod::Coverage>, |
186
|
|
|
|
|
|
|
L<Test::Pod::Coverage> |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 AUTHOR |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Robert 'phaylon' Sedlacek <rs@474.at> |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
This software is copyright (c) 2007 by Robert 'phaylon' Sedlacek. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
197
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=over 4 |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=item * |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=item * |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=item * |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Vyacheslav Matyukhin <me@berekuk.ru> |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=back |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=cut |