line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Expression::Operator::Binary::Ge; |
2
|
2
|
|
|
2
|
|
1091
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
2
|
|
|
2
|
|
3
|
|
|
2
|
|
|
2
|
|
47
|
|
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
36
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
67
|
|
3
|
2
|
|
|
2
|
|
7
|
use parent 'DTL::Fast::Expression::Operator::Binary'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
10
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::OPS_HANDLERS{'>='} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
130
|
use Scalar::Util qw(looks_like_number); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
91
|
|
8
|
2
|
|
|
2
|
|
6
|
use locale; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub dispatch |
11
|
|
|
|
|
|
|
{ |
12
|
36
|
|
|
36
|
0
|
39
|
my( $self, $arg1, $arg2, $context) = @_; |
13
|
36
|
|
|
|
|
37
|
my ($arg1_type, $arg2_type) = (ref $arg1, ref $arg2); |
14
|
36
|
|
|
|
|
22
|
my $result = 0; |
15
|
|
|
|
|
|
|
|
16
|
36
|
100
|
100
|
|
|
255
|
if( looks_like_number($arg1) and looks_like_number($arg2)) |
|
|
50
|
33
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
50
|
|
|
|
|
|
17
|
|
|
|
|
|
|
{ |
18
|
24
|
|
|
|
|
53
|
$result = ($arg1 >= $arg2); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
elsif( $arg1_type eq 'ARRAY' and $arg2_type eq 'ARRAY' ) # @todo check that $arg1 includes $arg2 |
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 |
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) > -1 ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
elsif( |
36
|
|
|
|
|
|
|
defined $arg1 |
37
|
|
|
|
|
|
|
and defined $arg2 |
38
|
|
|
|
|
|
|
) |
39
|
|
|
|
|
|
|
{ |
40
|
12
|
|
|
|
|
22
|
$result = ($arg1 ge $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
|
36
|
|
|
|
|
78
|
return $result; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |