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

filter: Statementstmt 92.3% 24 / 26 Branchbran 25.0% 1 / 4 Conditioncond 9.0% 1 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 59.2% 32 / 54 SCAR 24.1
CC
8
Cov
63%
dispatch
25.8
BEGIN
1.0
BEGIN
1.0
CRAP 11.1
« blib/lib/DTL/Fast/FilterManager.pm ↑ Summary blib/lib/DTL/Fast/Expression/Operator/Binary/Pow.pm »
1 package DTL::Fast::Expression::Operator::Binary::Mod;
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{'mod'} = __PACKAGE__;
6 2 $DTL::Fast::OPS_HANDLERS{'%'} = __PACKAGE__;
7  
8 2 ▶use Scalar::Util qw(looks_like_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 sub dispatch
11 {
12 44 ▶ my( $self, $arg1, $arg2, $context) = @_;
Subroutine dispatch: called CC=8 SCAR=32.5
Pod undocumented
13 44 my ($arg1_type, $arg2_type) = (ref $arg1, ref $arg2);
14 44 my $result = 0;
15  
16 44 ▶ 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 0 44
elsif (UNIVERSAL::can($arg1, 'mod')) { } 0 0 0
Condition33%1/3
&looks_like_number($arg1) and &looks_like_number($arg2)
!ll&&!rl&&r
0044
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
17 {
18 44 $result = ($arg1 % $arg2);
19 }
20 elsif( UNIVERSAL::can($arg1, 'mod'))
21 {
22 0 $result = $arg1->mod($arg2);
23 }
24 else
25 {
26 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
27 $context,
28 sprintf("don't know how to take %s (%s) modulus %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 2 1;
« blib/lib/DTL/Fast/FilterManager.pm ↑ Summary blib/lib/DTL/Fast/Expression/Operator/Binary/Pow.pm »