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