lib/Parse/FieldPath/Role.pm

filter: Statementstmt 100% 14 / 14 Branchbran n/a Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 4 / 4 Podpod 100% 2 / 2 totaltotal 100% 25 / 25 CC 2 SCAR 3.4
CC
2
Cov
100%
all_fields
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« script/rebuild_grammar.pl ↑ Summary
1 package Parse::FieldPath::Role;
2 {
3 1 $Parse::FieldPath::Role::VERSION = '0.005';
4 }
5  
6 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Parse::FieldPath;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 ▶sub all_fields {
Subroutine all_fields: called CC=2 SCAR=6.9
Pod documented
10 3 my ($self) = @_;
11 15 return [ grep { defined }
12 3 ▶ map { $_->accessor || $_->reader } $self->meta->get_all_attributes ];
Condition100%3/3
$_->accessor || $_->reader
l!l&&r!l&&!r
663
MC/DC100%2/2
$_->accessor || $_->reader
$_->accessor $_->reader
Truth table100%3/3
A || B
A= $_->accessorB= $_->reader
ABresult
1X1
011
000
13 }
14  
15 2 ▶sub extract_fields {
Subroutine extract_fields: called CC=1 SCAR=0.0
Pod documented
16 2 return Parse::FieldPath::extract_fields(@_);
17 }
18  
19 1 1;
20  
21 =pod
22  
23 =head1 NAME
24  
25 Parse::FieldPath::Role
26  
27 =head1 ABSTRACT
28  
29 Moose role to provide an C<extract_fields> method.
30  
31 =head1 SYNOPSIS
32  
33 package Boris;
34  
35 use Moose;
36 with 'Parse::FieldPath::Role';
37  
38 has plan => ( is => 'rw' );
39 has tnt => ( is => 'rw' );
40  
41 # Meanwhile..
42 my $boris = Boris->new(plan => 'a very evil plan', tnt => 'lots');
43 $boris->extract_fields(""); # returns: {
44 plan => 'a very evil plan',
45 tnt => 'lots',
46 }
47  
48 =head1 PROVIDED METHODS
49  
50 =over 4
51  
52 =item B<all_fields()>
53  
54 Called by C<extract_fields()> to get a list of every available field for the
55 object. This implementation return the name of every attribute reader method.
56  
57 =item B<extract_fields($field_path)>
58  
59 Calls C<extract_fields> from L<Parse::FieldPath> on the object.
60  
61 =back
62  
63 =cut
« script/rebuild_grammar.pl ↑ Summary