line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Expression::Operator::Binary::Eq; |
2
|
9
|
|
|
9
|
|
1864
|
use strict; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
209
|
|
3
|
9
|
|
|
9
|
|
37
|
use utf8; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
38
|
|
4
|
9
|
|
|
9
|
|
186
|
use warnings FATAL => 'all'; |
|
9
|
|
|
|
|
30
|
|
|
9
|
|
|
|
|
270
|
|
5
|
9
|
|
|
9
|
|
42
|
use parent 'DTL::Fast::Expression::Operator::Binary'; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
42
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$DTL::Fast::OPS_HANDLERS{'=='} = __PACKAGE__; |
8
|
|
|
|
|
|
|
|
9
|
9
|
|
|
9
|
|
482
|
use Scalar::Util qw(looks_like_number); |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
428
|
|
10
|
9
|
|
|
9
|
|
3231
|
use locale; |
|
9
|
|
|
|
|
4106
|
|
|
9
|
|
|
|
|
44
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# @todo Recurursion protection on deep comparision or one-level comparision |
13
|
|
|
|
|
|
|
sub dispatch |
14
|
|
|
|
|
|
|
{ |
15
|
157
|
|
|
157
|
0
|
326
|
my ( $self, $arg1, $arg2) = @_; |
16
|
157
|
|
|
|
|
303
|
my ($arg1_type, $arg2_type) = (ref $arg1, ref $arg2); |
17
|
157
|
|
|
|
|
265
|
my $result = 0; |
18
|
|
|
|
|
|
|
|
19
|
157
|
100
|
66
|
|
|
1679
|
if ( |
|
|
100
|
100
|
|
|
|
|
|
|
100
|
33
|
|
|
|
|
|
|
50
|
66
|
|
|
|
|
|
|
50
|
100
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
20
|
|
|
|
|
|
|
not defined $arg1 and defined $arg2 |
21
|
|
|
|
|
|
|
or not defined $arg2 and defined $arg1 |
22
|
|
|
|
|
|
|
) |
23
|
|
|
|
|
|
|
{ |
24
|
12
|
|
|
|
|
20
|
$result = 0; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
elsif (not defined $arg1 and not defined $arg2) |
27
|
|
|
|
|
|
|
{ |
28
|
2
|
|
|
|
|
4
|
$result = 1; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
elsif (looks_like_number($arg1) and looks_like_number($arg2)) |
31
|
|
|
|
|
|
|
{ |
32
|
93
|
|
|
|
|
187
|
$result = ($arg1 == $arg2); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
elsif ($arg1_type eq 'ARRAY' and $arg2_type eq 'ARRAY') |
35
|
|
|
|
|
|
|
{ |
36
|
0
|
0
|
|
|
|
0
|
if (scalar @$arg1 == scalar @$arg2) |
37
|
|
|
|
|
|
|
{ |
38
|
0
|
|
|
|
|
0
|
$result = 1; |
39
|
0
|
|
|
|
|
0
|
for (my $i = 0; $i < scalar @$arg1; $i++) |
40
|
|
|
|
|
|
|
{ |
41
|
0
|
0
|
|
|
|
0
|
if (not dispatch($self, $arg1->[$i], $arg2->[$i] )) |
42
|
|
|
|
|
|
|
{ |
43
|
0
|
|
|
|
|
0
|
$result = 0; |
44
|
0
|
|
|
|
|
0
|
last; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
elsif ($arg1_type eq 'HASH' and $arg2_type eq 'HASH') |
50
|
|
|
|
|
|
|
{ |
51
|
0
|
|
|
|
|
0
|
my @keys1 = sort keys %$arg1; |
52
|
0
|
|
|
|
|
0
|
my @keys2 = sort keys %$arg2; |
53
|
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
0
|
if (dispatch( $self, \@keys1, \@keys2 )) |
55
|
|
|
|
|
|
|
{ |
56
|
0
|
|
|
|
|
0
|
my $result = 1; |
57
|
0
|
|
|
|
|
0
|
foreach my $key (@keys1) |
58
|
|
|
|
|
|
|
{ |
59
|
0
|
0
|
|
|
|
0
|
if (not dispatch($self, $arg1->{$key}, $arg2->{$key} )) |
60
|
|
|
|
|
|
|
{ |
61
|
0
|
|
|
|
|
0
|
$result = 0; |
62
|
0
|
|
|
|
|
0
|
last; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
elsif (UNIVERSAL::can($arg1, 'equal')) |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
|
|
|
|
0
|
$result = $arg1->equal($arg2); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
elsif (UNIVERSAL::can($arg2, 'equal')) |
72
|
|
|
|
|
|
|
{ |
73
|
0
|
|
|
|
|
0
|
$result = $arg2->equal($arg1); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
else |
76
|
|
|
|
|
|
|
{ |
77
|
50
|
|
|
|
|
107
|
$result = ($arg1 eq $arg2); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
157
|
|
|
|
|
562
|
return $result; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |