line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::String::Compare; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
102552
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
72
|
|
4
|
2
|
|
|
2
|
|
10
|
use base qw/Template::Plugin::String/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
2880
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
$Template::Plugin::String::Compare::VERSION = 0.01; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use overload ( |
9
|
2
|
|
|
|
|
18
|
'<' => \&_lt, |
10
|
|
|
|
|
|
|
'>' => \&_gt, |
11
|
|
|
|
|
|
|
'<=' => \&_le, |
12
|
|
|
|
|
|
|
'>=' => \&_ge, |
13
|
|
|
|
|
|
|
fallback => 1, |
14
|
2
|
|
|
2
|
|
21802
|
); |
|
2
|
|
|
|
|
9
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _lt { |
17
|
3
|
100
|
|
3
|
|
40324
|
return $_[2] |
18
|
|
|
|
|
|
|
? "$_[1]" lt "$_[0]" |
19
|
|
|
|
|
|
|
: "$_[0]" lt "$_[1]"; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _gt { |
23
|
3
|
100
|
|
3
|
|
151
|
return $_[2] |
24
|
|
|
|
|
|
|
? "$_[1]" gt "$_[0]" |
25
|
|
|
|
|
|
|
: "$_[0]" gt "$_[1]"; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _le { |
29
|
6
|
100
|
|
6
|
|
302
|
return $_[2] |
30
|
|
|
|
|
|
|
? "$_[1]" le "$_[0]" |
31
|
|
|
|
|
|
|
: "$_[0]" le "$_[1]"; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _ge { |
35
|
6
|
100
|
|
6
|
|
277
|
return $_[2] |
36
|
|
|
|
|
|
|
? "$_[1]" ge "$_[0]" |
37
|
|
|
|
|
|
|
: "$_[0]" ge "$_[1]"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub compare { |
41
|
3
|
|
|
3
|
1
|
160
|
my ($self, $text) = @_; |
42
|
3
|
|
|
|
|
110
|
return "$self" cmp "$text"; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
__END__ |