line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Expression::Operator::Binary::Pow; |
2
|
2
|
|
|
2
|
|
1552
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
2
|
|
|
2
|
|
3
|
|
|
2
|
|
|
2
|
|
48
|
|
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
119
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
73
|
|
3
|
2
|
|
|
2
|
|
9
|
use parent 'DTL::Fast::Expression::Operator::Binary'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::OPS_HANDLERS{'**'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
$DTL::Fast::OPS_HANDLERS{'pow'} = __PACKAGE__; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
154
|
use Scalar::Util qw(looks_like_number); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
420
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub dispatch |
11
|
|
|
|
|
|
|
{ |
12
|
9
|
|
|
9
|
0
|
17
|
my( $self, $arg1, $arg2, $context) = @_; |
13
|
9
|
|
|
|
|
15
|
my ($arg1_type, $arg2_type) = (ref $arg1, ref $arg2); |
14
|
9
|
|
|
|
|
11
|
my $result = 0; |
15
|
|
|
|
|
|
|
|
16
|
9
|
50
|
33
|
|
|
54
|
if( looks_like_number($arg1) and looks_like_number($arg2)) |
|
|
0
|
|
|
|
|
|
17
|
|
|
|
|
|
|
{ |
18
|
9
|
|
|
|
|
38
|
$result = ($arg1 ** $arg2); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
elsif( UNIVERSAL::can($arg1, 'pow')) |
21
|
|
|
|
|
|
|
{ |
22
|
0
|
|
|
|
|
0
|
$result = $arg1->pow($arg2); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
else |
25
|
|
|
|
|
|
|
{ |
26
|
0
|
|
0
|
|
|
0
|
die $self->get_render_error( |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
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
|
|
|
|
|
26
|
return $result; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |