line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Expression::Operator::Binary::Pow; |
2
|
2
|
|
|
2
|
|
1178
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
2
|
|
|
2
|
|
3
|
|
|
2
|
|
|
2
|
|
57
|
|
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
52
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
80
|
|
3
|
2
|
|
|
2
|
|
10
|
use parent 'DTL::Fast::Expression::Operator::Binary'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
16
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::OPS_HANDLERS{'**'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
$DTL::Fast::OPS_HANDLERS{'pow'} = __PACKAGE__; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
152
|
use Scalar::Util qw(looks_like_number); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
373
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub dispatch |
11
|
|
|
|
|
|
|
{ |
12
|
9
|
|
|
9
|
0
|
11
|
my( $self, $arg1, $arg2, $context) = @_; |
13
|
9
|
|
|
|
|
8
|
my ($arg1_type, $arg2_type) = (ref $arg1, ref $arg2); |
14
|
9
|
|
|
|
|
7
|
my $result = 0; |
15
|
|
|
|
|
|
|
|
16
|
9
|
50
|
33
|
|
|
54
|
if( looks_like_number($arg1) and looks_like_number($arg2)) |
|
|
0
|
|
|
|
|
|
17
|
|
|
|
|
|
|
{ |
18
|
9
|
|
|
|
|
28
|
$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
|
|
|
|
|
17
|
return $result; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |