blib/lib/DTL/Fast/Expression/Operator/Binary/Minus.pm

filter: Statementstmt 84.0% 21 / 25 Branchbran 12.5% 1 / 8 Conditioncond 9.0% 1 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 50.8% 29 / 57 SCAR 30.4
CC
10
Cov
52%
dispatch
57.1
BEGIN
1.0
BEGIN
1.0
CRAP 20.9
« blib/lib/DTL/Fast/Parser.pm ↑ Summary blib/lib/DTL/Fast/Variable.pm »
1 package DTL::Fast::Expression::Operator::Binary::Minus;
2 2 ▶use strict; use utf8; use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use parent 'DTL::Fast::Expression::Operator::Binary';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 $DTL::Fast::OPS_HANDLERS{'-'} = __PACKAGE__;
6  
7 2 ▶use Scalar::Util qw(looks_like_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 sub dispatch
10 {
11 42 ▶ my( $self, $arg1, $arg2, $context) = @_;
Subroutine dispatch: called CC=10 SCAR=40.4
Pod undocumented
12 42 my ($arg1_type, $arg2_type) = (ref $arg1, ref $arg2);
13  
14 42 ▶ if( looks_like_number($arg1) and looks_like_number($arg2))
Branch: 4 branches
BranchTrueFalseTotal
if (&looks_like_number($arg1) and &looks_like_number($arg2)) { } 42 0 42
elsif ($arg1_type eq 'ARRAY') { } 0 0 0
elsif ($arg1_type eq 'HASH') { } 0 0 0
elsif (UNIVERSAL::can($arg1, 'minus')) { } 0 0 0
Condition33%1/3
&looks_like_number($arg1) and &looks_like_number($arg2)
!ll&&!rl&&r
0042
MC/DC0%0/2
&looks_like_number($arg1) and &looks_like_number($arg2)
&looks_like_number($arg1) &looks_like_number($arg2)
Truth table33%1/3
A and B
A= &looks_like_number($arg1)B= &looks_like_number($arg2)
ABresult
0X0
100
111
15 {
16 42 return $arg1 - $arg2;
17 }
18 elsif( $arg1_type eq 'ARRAY' ) # @todo array substitution
19 {
20 0 die $self->get_render_error( $context, 'arrays substitution not yet implemented');
21 }
22 elsif( $arg1_type eq 'HASH' ) # @todo hash substitution
23 {
24 0 die $self->get_render_error( $context, 'hashes substitution not yet implemented');
25 }
26 elsif( UNIVERSAL::can($arg1, 'minus'))
27 {
28 0 return $arg1->minus($arg2);
29 }
30 else
31 {
32 0 ▶ die $self->get_render_error(
Condition0%0/8
$arg1 // "undef"
l!l
00
$arg1_type || 'SCALAR'
l!l
00
$arg2 // "undef"
l!l
00
$arg2_type || 'SCALAR'
l!l
00
MC/DC0%0/1
$arg1 // "undef"
$arg1
MC/DC0%0/1
$arg1_type || 'SCALAR'
$arg1_type
MC/DC0%0/1
$arg2 // "undef"
$arg2
MC/DC0%0/1
$arg2_type || 'SCALAR'
$arg2_type
Truth table0%0/2
A
A= $arg1
Aresult
11
00
Truth table0%0/2
A
A= $arg1_type
Aresult
11
00
Truth table0%0/2
A
A= $arg2
Aresult
11
00
Truth table0%0/2
A
A= $arg2_type
Aresult
11
00
33 $context,
34 sprintf("don't know how to substitute %s (%s) from %s (%s)"
35 , $arg1 // 'undef'
36 , $arg1_type || 'SCALAR'
37 , $arg2 // 'undef'
38 , $arg2_type || 'SCALAR'
39 )
40 );
41 }
42 }
43  
44 2 1;
« blib/lib/DTL/Fast/Parser.pm ↑ Summary blib/lib/DTL/Fast/Variable.pm »