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

filter: Statementstmt 96.0% 24 / 25 Branchbran 75.0% 3 / 4 Conditioncond 54.5% 6 / 11 MC/DCmcdc 16.6% 1 / 6 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 75.4% 40 / 53 SCAR 21.2
CC
8
Cov
82%
dispatch
9.8
BEGIN
1.0
BEGIN
1.0
CRAP 8.3
« blib/lib/DTL/Fast/Replacer.pm ↑ Summary blib/lib/DTL/Fast/Filter/Join.pm »
1 package DTL::Fast::Expression::Operator::Binary::Div;
2 3 ▶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 3 ▶use parent 'DTL::Fast::Expression::Operator::Binary';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 $DTL::Fast::OPS_HANDLERS{'/'} = __PACKAGE__;
6  
7 3 ▶use Scalar::Util qw(looks_like_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 sub dispatch
10 {
11 46 ▶ my( $self, $arg1, $arg2, $context) = @_;
Subroutine dispatch: called CC=8 SCAR=22.8
Pod undocumented
12 46 my ($arg1_type, $arg2_type) = (ref $arg1, ref $arg2);
13 46 my $result = 0;
14  
15 46 ▶ if( looks_like_number($arg1) and looks_like_number($arg2))
Branch: 2 branches
BranchTrueFalseTotal
if (&looks_like_number($arg1) and &looks_like_number($arg2)) { } 44 2 46
elsif (UNIVERSAL::can($arg1, 'div')) { } 0 2 2
Condition66%2/3
&looks_like_number($arg1) and &looks_like_number($arg2)
!ll&&!rl&&r
2044
MC/DC50%1/2
&looks_like_number($arg1) and &looks_like_number($arg2)
&looks_like_number($arg1) &looks_like_number($arg2)
Truth table66%2/3
A and B
A= &looks_like_number($arg1)B= &looks_like_number($arg2)
ABresult
0X0
100
111
16 {
17 44 $result = ($arg1 / $arg2);
18 }
19 elsif( UNIVERSAL::can($arg1, 'div'))
20 {
21 0 $result = $arg1->div($arg2);
22 }
23 else
24 {
25 2 ▶ die $self->get_render_error(
Condition50%4/8
$arg1 // "undef"
l!l
02
$arg1_type || 'SCALAR'
l!l
02
$arg2 // "undef"
l!l
20
$arg2_type || 'SCALAR'
l!l
02
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 table50%1/2
A
A= $arg1
Aresult
11
00
Truth table50%1/2
A
A= $arg1_type
Aresult
11
00
Truth table50%1/2
A
A= $arg2
Aresult
11
00
Truth table50%1/2
A
A= $arg2_type
Aresult
11
00
26 $context,
27 sprintf(
28 "Don't know how to divide %s (%s) by %s (%s)"
29 , $arg1 // 'undef'
30 , $arg1_type || 'SCALAR'
31 , $arg2 // 'undef'
32 , $arg2_type || 'SCALAR'
33 )
34 );
35 }
36  
37 44 return $result;
38 }
39  
40 3 1;
« blib/lib/DTL/Fast/Replacer.pm ↑ Summary blib/lib/DTL/Fast/Filter/Join.pm »