Geoffrey/Changeset.pm

filter: Statementstmt 96.0% 48 / 50 Branchbran 68.7% 11 / 16 Conditioncond 44.4% 4 / 9 MC/DCmcdc 40.0% 2 / 5 Subroutinesub 100% 12 / 12 Podpod 100% 6 / 6 totaltotal 84.6% 83 / 98 CC 14 SCAR 12.2
CC
14
Cov
84%
handle_entry
6.3
postfix
3.7
prefix
3.7
CRAP 3.4
« Geoffrey/Action/Function.pm ↑ Summary Geoffrey/Action/Constraint.pm »
1 package Geoffrey::Changeset;
2  
3 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use Geoffrey::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 $Geoffrey::Changeset::VERSION = '0.000206';
10  
11 3 ▶use parent 'Geoffrey::Role::Core';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 36 ▶sub action {
Subroutine action: called CC=1 SCAR=0.0
Pod documented
14 36 my ( $self, $s_action ) = @_;
15 36 return Geoffrey::Utils::action_obj_from_name(
16 $s_action,
17 dbh => $self->dbh,
18 converter => $self->converter,
19 template => $self->template,
20 );
21 }
22  
23 3 ▶sub postfix {
Subroutine postfix: called CC=3 SCAR=13.1
Pod documented
24 3 ▶ return $_[0]->{postfix} // q~~ if !defined $_[1];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[1] 0 3 3
Condition0%0/2
$_[0]{"postfix"} // ""
l!l
00
MC/DC0%0/1
$_[0]{"postfix"} // ""
$_[0]{"postfix"}
Truth table0%0/2
A
A= $_[0]{"postfix"}
Aresult
11
00
25 3 $_[0]->{postfix} = $_[1];
26 3 return $_[0]->{postfix};
27 }
28  
29 3 ▶sub prefix {
Subroutine prefix: called CC=3 SCAR=13.1
Pod documented
30 3 ▶ return $_[0]->{prefix} // q~~ if !defined $_[1];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[1] 0 3 3
Condition0%0/2
$_[0]{"prefix"} // ""
l!l
00
MC/DC0%0/1
$_[0]{"prefix"} // ""
$_[0]{"prefix"}
Truth table0%0/2
A
A= $_[0]{"prefix"}
Aresult
11
00
31 3 $_[0]->{prefix} = $_[1];
32 3 return $_[0]->{prefix};
33 }
34  
35 37 ▶sub template {
Subroutine template: called CC=3 SCAR=11.0
Pod documented
36 37 ▶ return $_[0]->{template} // q~~ if !defined $_[1];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[1] 36 1 37
Condition100%2/2
$_[0]{"template"} // ""
l!l
1224
MC/DC100%1/1
$_[0]{"template"} // ""
$_[0]{"template"}
Truth table100%2/2
A
A= $_[0]{"template"}
Aresult
11
00
37 1 $_[0]->{template} = $_[1];
38 1 return $_[0]->{template};
39 }
40  
41 36 ▶sub handle_entry {
Subroutine handle_entry: called CC=6 SCAR=18.4
Pod documented
42 36 my ( $self, $hr_entry ) = @_;
43 36 ▶ return unless $hr_entry;
Branch: 1 branch
BranchTrueFalseTotal
unless $hr_entry 0 36 36
44 36 ▶ unless ( $hr_entry->{action} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($hr_entry->{"action"}) 0 36 36
45 0 require Geoffrey::Exception::General;
46 0 Geoffrey::Exception::General::throw_no_params( 'handle_entry', 'action', $hr_entry );
47 }
48 36 my ( $s_sub, $s_action ) = Geoffrey::Utils::parse_package_sub( delete $hr_entry->{action} );
49 36 my $o_action = $self->action($s_action);
50 35 ▶ if ( !$s_sub || !$o_action->can($s_sub) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($s_sub and $o_action->can($s_sub)) 1 34 35
Condition66%2/3
$s_sub and $o_action->can($s_sub)
!ll&&!rl&&r
0134
MC/DC50%1/2
$s_sub and $o_action->can($s_sub)
$s_sub $o_action->can($s_sub)
Truth table66%2/3
A and B
A= $s_subB= $o_action->can($s_sub)
ABresult
0X0
100
111
51 1 require Geoffrey::Exception::RequiredValue;
52 1 Geoffrey::Exception::RequiredValue::throw_action_sub($s_action);
53 }
54 34 ▶ $o_action->dryrun(1) if delete $hr_entry->{dryrun};
Branch: 1 branch
BranchTrueFalseTotal
if delete $hr_entry->{"dryrun"} 3 31 34
55 34 my $result = $o_action->$s_sub($hr_entry);
56 12 $o_action->dryrun(0);
57 12 return $result;
58  
59 }
60  
61 30 ▶sub handle_entries {
Subroutine handle_entries: called CC=3 SCAR=11.0
Pod documented
62 30 my ( $self, $ar_entries ) = @_;
63 30 ▶ return unless $ar_entries;
Branch: 1 branch
BranchTrueFalseTotal
unless $ar_entries 0 30 30
64 30 $self->handle_entry($_) for ( @{$ar_entries} );
65 6 return scalar @{$ar_entries};
66 }
67  
68 3 1; # End of Geoffrey::Changeset
69  
70 __END__
« Geoffrey/Action/Function.pm ↑ Summary Geoffrey/Action/Constraint.pm »