line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Expression::Operator::Binary::Pow; |
2
|
2
|
|
|
2
|
|
970
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
338
|
|
3
|
2
|
|
|
2
|
|
11
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
4
|
2
|
|
|
2
|
|
41
|
use warnings FATAL => 'all'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
64
|
|
5
|
2
|
|
|
2
|
|
10
|
use parent 'DTL::Fast::Expression::Operator::Binary'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$DTL::Fast::OPS_HANDLERS{'**'} = __PACKAGE__; |
8
|
|
|
|
|
|
|
$DTL::Fast::OPS_HANDLERS{pow} = __PACKAGE__; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
137
|
use Scalar::Util qw(looks_like_number); |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
322
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub dispatch |
13
|
|
|
|
|
|
|
{ |
14
|
9
|
|
|
9
|
0
|
20
|
my ( $self, $arg1, $arg2, $context) = @_; |
15
|
9
|
|
|
|
|
17
|
my ($arg1_type, $arg2_type) = (ref $arg1, ref $arg2); |
16
|
9
|
|
|
|
|
17
|
my $result = 0; |
17
|
|
|
|
|
|
|
|
18
|
9
|
50
|
33
|
|
|
54
|
if (looks_like_number($arg1) and looks_like_number($arg2)) |
|
|
0
|
|
|
|
|
|
19
|
|
|
|
|
|
|
{ |
20
|
9
|
|
|
|
|
37
|
$result = ($arg1 ** $arg2); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
elsif (UNIVERSAL::can($arg1, 'pow')) |
23
|
|
|
|
|
|
|
{ |
24
|
0
|
|
|
|
|
0
|
$result = $arg1->pow($arg2); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
else |
27
|
|
|
|
|
|
|
{ |
28
|
0
|
|
0
|
|
|
0
|
die $self->get_render_error( |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
29
|
|
|
|
|
|
|
$context, |
30
|
|
|
|
|
|
|
sprintf( |
31
|
|
|
|
|
|
|
"don't know how to involute %s (%s) to power of %s (%s)" |
32
|
|
|
|
|
|
|
, $arg1 // 'undef' |
33
|
|
|
|
|
|
|
, $arg1_type || 'SCALAR' |
34
|
|
|
|
|
|
|
, $arg2 // 'undef' |
35
|
|
|
|
|
|
|
, $arg2_type || 'SCALAR' |
36
|
|
|
|
|
|
|
) |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
9
|
|
|
|
|
25
|
return $result; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |