line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Expression::Operator::Binary::Gt; |
2
|
4
|
|
|
4
|
|
1777
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
99
|
|
3
|
4
|
|
|
4
|
|
18
|
use utf8; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
43
|
|
4
|
4
|
|
|
4
|
|
86
|
use warnings FATAL => 'all'; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
114
|
|
5
|
4
|
|
|
4
|
|
17
|
use parent 'DTL::Fast::Expression::Operator::Binary'; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
18
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$DTL::Fast::OPS_HANDLERS{'>'} = __PACKAGE__; |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
266
|
use Scalar::Util qw(looks_like_number); |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
165
|
|
10
|
4
|
|
|
4
|
|
352
|
use locale; |
|
4
|
|
|
|
|
472
|
|
|
4
|
|
|
|
|
28
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub dispatch |
13
|
|
|
|
|
|
|
{ |
14
|
481
|
|
|
481
|
0
|
852
|
my ( $self, $arg1, $arg2, $context) = @_; |
15
|
481
|
|
|
|
|
862
|
my ($arg1_type, $arg2_type) = (ref $arg1, ref $arg2); |
16
|
481
|
|
|
|
|
722
|
my $result = 0; |
17
|
|
|
|
|
|
|
|
18
|
481
|
100
|
100
|
|
|
2312
|
if (looks_like_number($arg1) and looks_like_number($arg2)) |
|
|
50
|
33
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
50
|
|
|
|
|
|
19
|
|
|
|
|
|
|
{ |
20
|
469
|
|
|
|
|
913
|
$result = ($arg1 > $arg2); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
elsif ($arg1_type eq 'ARRAY' and $arg2_type eq 'ARRAY') # @todo check that $arg1 includes $arg2 and more |
23
|
|
|
|
|
|
|
{ |
24
|
0
|
|
|
|
|
0
|
$result = ( scalar @$arg1 > scalar @$arg2 ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
elsif ($arg1_type eq 'HASH' and $arg2_type eq 'HASH') # @todo check that $arg1 includes $arg2 and more |
27
|
|
|
|
|
|
|
{ |
28
|
0
|
|
|
|
|
0
|
my @keys1 = sort keys %$arg1; |
29
|
0
|
|
|
|
|
0
|
my @keys2 = sort keys %$arg2; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
0
|
$result = ( scalar @$arg1 > scalar @$arg2 ); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
elsif (UNIVERSAL::can($arg1, 'compare')) |
34
|
|
|
|
|
|
|
{ |
35
|
0
|
|
|
|
|
0
|
$result = ($arg1->compare($arg2) > 0); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
elsif ( |
38
|
|
|
|
|
|
|
defined $arg1 |
39
|
|
|
|
|
|
|
and defined $arg2 |
40
|
|
|
|
|
|
|
) |
41
|
|
|
|
|
|
|
{ |
42
|
12
|
|
|
|
|
32
|
$result = ($arg1 gt $arg2); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
else |
45
|
|
|
|
|
|
|
{ |
46
|
0
|
|
0
|
|
|
0
|
die $self->get_render_error( |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
47
|
|
|
|
|
|
|
$context, |
48
|
|
|
|
|
|
|
sprintf("don't know how to compare %s (%s) to %s (%s)" |
49
|
|
|
|
|
|
|
, $arg1 // 'undef' |
50
|
|
|
|
|
|
|
, $arg1_type || 'SCALAR' |
51
|
|
|
|
|
|
|
, $arg2 // 'undef' |
52
|
|
|
|
|
|
|
, $arg2_type || 'SCALAR' |
53
|
|
|
|
|
|
|
) |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
481
|
|
|
|
|
1582
|
return $result; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |