line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Expression::Operator::Binary::Mul; |
2
|
2
|
|
|
2
|
|
1179
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
2
|
|
|
2
|
|
2
|
|
|
2
|
|
|
2
|
|
47
|
|
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
49
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
79
|
|
3
|
2
|
|
|
2
|
|
10
|
use parent 'DTL::Fast::Expression::Operator::Binary'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
10
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::OPS_HANDLERS{'*'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
160
|
use Scalar::Util qw(looks_like_number); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
478
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub dispatch |
10
|
|
|
|
|
|
|
{ |
11
|
43
|
|
|
43
|
0
|
47
|
my( $self, $arg1, $arg2, $context) = @_; |
12
|
43
|
|
|
|
|
43
|
my ($arg1_type, $arg2_type) = (ref $arg1, ref $arg2); |
13
|
43
|
|
|
|
|
34
|
my $result = 0; |
14
|
|
|
|
|
|
|
|
15
|
43
|
100
|
66
|
|
|
180
|
if( looks_like_number($arg1) and looks_like_number($arg2)) |
|
|
50
|
33
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
16
|
|
|
|
|
|
|
{ |
17
|
42
|
|
|
|
|
51
|
$result = ($arg1 * $arg2); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
elsif( UNIVERSAL::can($arg1, 'mul')) |
20
|
|
|
|
|
|
|
{ |
21
|
0
|
|
|
|
|
0
|
$result = $arg1->mul($arg2); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
elsif( |
24
|
|
|
|
|
|
|
defined $arg2 |
25
|
|
|
|
|
|
|
and defined $arg1 |
26
|
|
|
|
|
|
|
and $arg2 =~ /^\d+$/) |
27
|
|
|
|
|
|
|
{ |
28
|
1
|
|
|
|
|
4
|
$result = "$arg1" x $arg2; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
else |
31
|
|
|
|
|
|
|
{ |
32
|
0
|
|
0
|
|
|
0
|
die $self->get_render_error( |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
33
|
|
|
|
|
|
|
$context, |
34
|
|
|
|
|
|
|
sprintf("don't know how to multiplicate %s (%s) to %s (%s)" |
35
|
|
|
|
|
|
|
, $arg1 // 'undef' |
36
|
|
|
|
|
|
|
, $arg1_type || 'SCALAR' |
37
|
|
|
|
|
|
|
, $arg2 // 'undef' |
38
|
|
|
|
|
|
|
, $arg2_type || 'SCALAR' |
39
|
|
|
|
|
|
|
) |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
43
|
|
|
|
|
96
|
return $result; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |