blib/lib/CPAN/Changes/Group.pm

filter: Statementstmt 71.7% 33 / 46 Branchbran 66.6% 4 / 6 Conditioncond 37.5% 3 / 8 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 72.7% 8 / 11 Podpod 100% 4 / 4 totaltotal 67.0% 53 / 79 CC 8 SCAR 13.5
CC
8
Cov
67%
serialize
12.0
__ANON__
4.0
_maybe_entry
2.1
CRAP 3.9
« blib/lib/CPAN/Changes/Entry.pm ↑ Summary corpus/dists/App-Ack.parsed »
1 package CPAN::Changes::Group;
2 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 16 our $VERSION = '0.500002';
6 16 $VERSION =~ tr/_//d;
7  
8 16 ▶use Sub::Quote qw(qsub);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 16 ▶use CPAN::Changes::Entry;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 16 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 16 has _entry => (
14 is => 'rw',
15 handles => {
16 is_empty => 'has_entries',
17 add_changes => 'add_entry',
18 name => 'text',
19 },
20 lazy => 1,
21 default => qsub q{ CPAN::Changes::Entry->new(text => '') },
22 predicate => 1,
23 );
24  
25 sub _maybe_entry {
26 2 ▶ my $self = shift;
Subroutine _maybe_entry: called CC=2 SCAR=7.6
27 2 ▶ if ($self->can('changes') == \&changes) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can('changes') == \&CPAN::Changes::Group::changes) { } 2 0 2
28 2 return $self->_entry;
29 }
30 else {
31 0 return CPAN::Changes::Entry->new(
32 text => $self->name,
33 entries => $self->changes,
34 );
35 }
36 }
37  
38 around BUILDARGS => sub {
39 41 ▶ my ($orig, $self, @args) = @_;
Subroutine __ANON__: called CC=4 SCAR=13.9
40 41 my $args = $self->$orig(@args);
41 41 ▶ if (!$args->{_entry}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($args->{"_entry"}) 5 36 41
42 $args->{_entry} = CPAN::Changes::Entry->new({
43 text => $args->{name} || '',
44 5 ▶ entries => $args->{changes} || [],
Condition75%3/4
$args->{'name'} || ''
l!l
32
$args->{'changes'} || []
l!l
05
MC/DC100%1/1
$args->{'name'} || ''
$args->{'name'}
MC/DC0%0/1
$args->{'changes'} || []
$args->{'changes'}
Truth table100%2/2
A
A= $args->{'name'}
Aresult
11
00
Truth table50%1/2
A
A= $args->{'changes'}
Aresult
11
00
45 });
46 }
47 41 $args;
48 16 };
49  
50 sub changes {
51 34 ▶ my ($self) = @_;
Subroutine changes: called CC=2 SCAR=7.0
Pod documented
52 34 ▶ return []
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_has_entry 0 34 34
53 unless $self->_has_entry;
54 34 [ map { $_->text } @{ $self->_entry->entries } ];
55 }
56  
57 sub set_changes {
58 0 ▶ my ($self, @changes) = @_;
Subroutine set_changes: not called CC=1 SCAR=6.9
Pod documented
59 0 my $entry = $self->_entry->clone(entries => \@changes);
60 0 $self->_entry($entry);
61 }
62  
63 sub clear_changes {
64 0 ▶ my ($self) = @_;
Subroutine clear_changes: not called CC=1 SCAR=6.9
Pod documented
65 0 my $entry = $self->_entry;
66 0 @{$entry->entries} = ();
67 0 $self->changes;
68 }
69  
70 sub serialize {
71 0 ▶ my ($self, %args) = @_;
Subroutine serialize: not called CC=3 SCAR=24.8
Pod documented
72 0 ▶ $args{indents} ||= [' ', ' '];
Condition0%0/2
$args{"indents"} ||= [" ", " "]
l!l
00
MC/DC0%0/1
$args{"indents"} ||= [" ", " "]
$args{"indents"}
Truth table0%0/2
A
A= $args{"indents"}
Aresult
11
00
73 0 ▶ $args{styles} ||= ['[]', '-'];
Condition0%0/2
$args{"styles"} ||= ["[]", "-"]
l!l
00
MC/DC0%0/1
$args{"styles"} ||= ["[]", "-"]
$args{"styles"}
Truth table0%0/2
A
A= $args{"styles"}
Aresult
11
00
74 0 $self->_maybe_entry->serialize(%args);
75 }
76  
77 16 1;
78 __END__
« blib/lib/CPAN/Changes/Entry.pm ↑ Summary corpus/dists/App-Ack.parsed »