| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DTL::Fast::Expression::Operator::Binary::Mod; |
|
2
|
2
|
|
|
2
|
|
1657
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
|
2
|
|
|
2
|
|
4
|
|
|
|
2
|
|
|
2
|
|
50
|
|
|
|
2
|
|
|
|
|
10
|
|
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
10
|
|
|
|
2
|
|
|
|
|
49
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
74
|
|
|
3
|
2
|
|
|
2
|
|
9
|
use parent 'DTL::Fast::Expression::Operator::Binary'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::OPS_HANDLERS{'mod'} = __PACKAGE__; |
|
6
|
|
|
|
|
|
|
$DTL::Fast::OPS_HANDLERS{'%'} = __PACKAGE__; |
|
7
|
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
172
|
use Scalar::Util qw(looks_like_number); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
421
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub dispatch |
|
11
|
|
|
|
|
|
|
{ |
|
12
|
44
|
|
|
44
|
0
|
154
|
my( $self, $arg1, $arg2, $context) = @_; |
|
13
|
44
|
|
|
|
|
127
|
my ($arg1_type, $arg2_type) = (ref $arg1, ref $arg2); |
|
14
|
44
|
|
|
|
|
56
|
my $result = 0; |
|
15
|
|
|
|
|
|
|
|
|
16
|
44
|
50
|
33
|
|
|
279
|
if( looks_like_number($arg1) and looks_like_number($arg2)) |
|
|
|
0
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
{ |
|
18
|
44
|
|
|
|
|
74
|
$result = ($arg1 % $arg2); |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
elsif( UNIVERSAL::can($arg1, 'mod')) |
|
21
|
|
|
|
|
|
|
{ |
|
22
|
0
|
|
|
|
|
0
|
$result = $arg1->mod($arg2); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
else |
|
25
|
|
|
|
|
|
|
{ |
|
26
|
0
|
|
0
|
|
|
0
|
die $self->get_render_error( |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$context, |
|
28
|
|
|
|
|
|
|
sprintf("don't know how to take %s (%s) modulus %s (%s)" |
|
29
|
|
|
|
|
|
|
, $arg1 // 'undef' |
|
30
|
|
|
|
|
|
|
, $arg1_type || 'SCALAR' |
|
31
|
|
|
|
|
|
|
, $arg2 // 'undef' |
|
32
|
|
|
|
|
|
|
, $arg2_type || 'SCALAR' |
|
33
|
|
|
|
|
|
|
) |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
44
|
|
|
|
|
144
|
return $result; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |