line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Expression::Operator::Binary::Minus; |
2
|
2
|
|
|
2
|
|
1893
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
2
|
|
|
2
|
|
5
|
|
|
2
|
|
|
2
|
|
55
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
49
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
72
|
|
3
|
2
|
|
|
2
|
|
10
|
use parent 'DTL::Fast::Expression::Operator::Binary'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
12
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::OPS_HANDLERS{'-'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
176
|
use Scalar::Util qw(looks_like_number); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
486
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub dispatch |
10
|
|
|
|
|
|
|
{ |
11
|
42
|
|
|
42
|
0
|
132
|
my( $self, $arg1, $arg2, $context) = @_; |
12
|
42
|
|
|
|
|
63
|
my ($arg1_type, $arg2_type) = (ref $arg1, ref $arg2); |
13
|
|
|
|
|
|
|
|
14
|
42
|
50
|
33
|
|
|
217
|
if( looks_like_number($arg1) and looks_like_number($arg2)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
15
|
|
|
|
|
|
|
{ |
16
|
42
|
|
|
|
|
245
|
return $arg1 - $arg2; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
elsif( $arg1_type eq 'ARRAY' ) # @todo array substitution |
19
|
|
|
|
|
|
|
{ |
20
|
0
|
|
|
|
|
|
die $self->get_render_error( $context, 'arrays substitution not yet implemented'); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
elsif( $arg1_type eq 'HASH' ) # @todo hash substitution |
23
|
|
|
|
|
|
|
{ |
24
|
0
|
|
|
|
|
|
die $self->get_render_error( $context, 'hashes substitution not yet implemented'); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
elsif( UNIVERSAL::can($arg1, 'minus')) |
27
|
|
|
|
|
|
|
{ |
28
|
0
|
|
|
|
|
|
return $arg1->minus($arg2); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
else |
31
|
|
|
|
|
|
|
{ |
32
|
0
|
|
0
|
|
|
|
die $self->get_render_error( |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
33
|
|
|
|
|
|
|
$context, |
34
|
|
|
|
|
|
|
sprintf("don't know how to substitute %s (%s) from %s (%s)" |
35
|
|
|
|
|
|
|
, $arg1 // 'undef' |
36
|
|
|
|
|
|
|
, $arg1_type || 'SCALAR' |
37
|
|
|
|
|
|
|
, $arg2 // 'undef' |
38
|
|
|
|
|
|
|
, $arg2_type || 'SCALAR' |
39
|
|
|
|
|
|
|
) |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |