| 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
| |||||||||||||||||||||||
| 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
| |||||||||||||||||||||||
| 42 | $args->{_entry} = CPAN::Changes::Entry->new({ | ||||||||||||||||||||||
| 43 | text => $args->{name} || '', | ||||||||||||||||||||||
| 44 | 5 | ▶ | entries => $args->{changes} || [], | ||||||||||||||||||||
|
Condition75%3/4
$args->{'name'} || ''
$args->{'changes'} || []
MC/DC100%1/1
$args->{'name'} || ''
$args->{'name'}
MC/DC0%0/1
$args->{'changes'} || []
$args->{'changes'}
Truth table100%2/2
A
A= $args->{'name'}
Truth table50%1/2
A
A= $args->{'changes'}
| |||||||||||||||||||||||
| 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
| |||||||||||||||||||||||
| 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"} ||= [" ", " "]
MC/DC0%0/1
$args{"indents"} ||= [" ", " "]
$args{"indents"}
Truth table0%0/2
A
A= $args{"indents"}
| |||||||||||||||||||||||
| 73 | 0 | ▶ | $args{styles} ||= ['[]', '-']; | ||||||||||||||||||||
|
Condition0%0/2
$args{"styles"} ||= ["[]", "-"]
MC/DC0%0/1
$args{"styles"} ||= ["[]", "-"]
$args{"styles"}
Truth table0%0/2
A
A= $args{"styles"}
| |||||||||||||||||||||||
| 74 | 0 | $self->_maybe_entry->serialize(%args); | |||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||
| 76 | |||||||||||||||||||||||
| 77 | 16 | 1; | |||||||||||||||||||||
| 78 | __END__ | ||||||||||||||||||||||