blib/lib/DTL/Fast/Expression/Operator/Binary/Pow.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/Expression/Operator/Binary/Mod.pm ↑ Summary blib/lib/DTL/Fast/Tag/Ssi.pm »
1 package DTL::Fast::Expression::Operator::Binary::Pow;
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 2 $DTL::Fast::OPS_HANDLERS{'pow'} = __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 9 ▶ my( $self, $arg1, $arg2, $context) = @_;
Subroutine dispatch: called CC=8 SCAR=32.5
Pod undocumented
13 9 my ($arg1_type, $arg2_type) = (ref $arg1, ref $arg2);
14 9 my $result = 0;
15  
16 9 ▶ if( looks_like_number($arg1) and looks_like_number($arg2))
Branch: 2 branches
BranchTrueFalseTotal
if (&looks_like_number($arg1) and &looks_like_number($arg2)) { } 9 0 9
elsif (UNIVERSAL::can($arg1, 'pow')) { } 0 0 0
Condition33%1/3
&looks_like_number($arg1) and &looks_like_number($arg2)
!ll&&!rl&&r
009
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 9 $result = ($arg1 ** $arg2);
19 }
20 elsif( UNIVERSAL::can($arg1, 'pow'))
21 {
22 0 $result = $arg1->pow($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(
29 "don't know how to involute %s (%s) to power of %s (%s)"
30 , $arg1 // 'undef'
31 , $arg1_type || 'SCALAR'
32 , $arg2 // 'undef'
33 , $arg2_type || 'SCALAR'
34 )
35 );
36 }
37  
38 9 return $result;
39 }
40  
41 2 1;
« blib/lib/DTL/Fast/Expression/Operator/Binary/Mod.pm ↑ Summary blib/lib/DTL/Fast/Tag/Ssi.pm »