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

filter: Statementstmt 92.3% 24 / 26 Branchbran 66.6% 4 / 6 Conditioncond 23.5% 4 / 17 MC/DCmcdc 11.1% 1 / 9 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 60.0% 39 / 65 SCAR 27.8
CC
11
Cov
65%
dispatch
29.1
BEGIN
1.0
BEGIN
1.0
CRAP 16.1
« blib/lib/DTL/Fast/Tag/Url.pm ↑ Summary blib/lib/DTL/Fast/Filter/Add.pm »
1 package DTL::Fast::Expression::Operator::Binary::Mul;
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 43 ▶ my( $self, $arg1, $arg2, $context) = @_;
Subroutine dispatch: called CC=11 SCAR=33.7
Pod undocumented
12 43 my ($arg1_type, $arg2_type) = (ref $arg1, ref $arg2);
13 43 my $result = 0;
14  
15 43 ▶ if( looks_like_number($arg1) and looks_like_number($arg2))
Branch: 3 branches
BranchTrueFalseTotal
if (&looks_like_number($arg1) and &looks_like_number($arg2)) { } 42 1 43
elsif (UNIVERSAL::can($arg1, 'mul')) { } 0 1 1
elsif (defined $arg2 and defined $arg1 and $arg2 =~ /^\d+$/) { } 1 0 1
Condition66%2/3
&looks_like_number($arg1) and &looks_like_number($arg2)
!ll&&!rl&&r
1042
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 42 $result = ($arg1 * $arg2);
18 }
19 elsif( UNIVERSAL::can($arg1, 'mul'))
20 {
21 0 $result = $arg1->mul($arg2);
22 }
23 ▶ elsif(
Condition33%2/6
defined $arg2 and defined $arg1 and $arg2 =~ /^\d+$/
!ll&&!rl&&r
001
defined $arg2 and defined $arg1
!ll&&!rl&&r
001
MC/DC0%0/3
defined $arg2 and defined $arg1 and $arg2 =~ /^\d+$/
defined $arg2 defined $arg1 $arg2 =~ /^\d+$/
Truth table25%1/4
A and B and C
A= defined $arg2B= defined $arg1C= $arg2 =~ /^\d+$/
ABCresult
0XX0
10X0
1100
1111
24 defined $arg2
25 and defined $arg1
26 and $arg2 =~ /^\d+$/)
27 {
28 1 $result = "$arg1" x $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 multiplicate %s (%s) to %s (%s)"
35 , $arg1 // 'undef'
36 , $arg1_type || 'SCALAR'
37 , $arg2 // 'undef'
38 , $arg2_type || 'SCALAR'
39 )
40 );
41 }
42  
43 43 return $result;
44 }
45  
46 2 1;
« blib/lib/DTL/Fast/Tag/Url.pm ↑ Summary blib/lib/DTL/Fast/Filter/Add.pm »