line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package String::ZeroButTrue; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
24296
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
$String::ZeroButTrue::VERSION = '0.2'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use base 'Exporter'; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
291
|
|
9
|
|
|
|
|
|
|
@String::ZeroButTrue::EXPORT = qw(get_zero_but_true is_zero_but_true); |
10
|
|
|
|
|
|
|
@String::ZeroButTrue::EXPORT_OK = qw(get_zero_but_true_uc get_zero_but_true_phrase); |
11
|
|
|
|
|
|
|
%String::ZeroButTrue::EXPORT_TAGS = ( |
12
|
|
|
|
|
|
|
'all' => [@String::ZeroButTrue::EXPORT, @String::ZeroButTrue::EXPORT_OK], |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub get_zero_but_true { |
16
|
1
|
|
|
1
|
1
|
5
|
return '0e0'; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub get_zero_but_true_uc { |
20
|
1
|
|
|
1
|
1
|
6
|
return '0E0'; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub get_zero_but_true_phrase { |
24
|
1
|
|
|
1
|
1
|
5
|
return '0 but true'; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub is_zero_but_true { |
28
|
9
|
|
|
9
|
1
|
323
|
my $string = shift; |
29
|
|
|
|
|
|
|
# We have to do a string eq because $string && $string == 0 it true when its a string being compared numerically: |
30
|
|
|
|
|
|
|
# perl -Mstrict -we 'if ("hello world" == 0) { print "yes it is 0\n" } |
31
|
|
|
|
|
|
|
# no warnings 'numeric'; # string might *be* a string == Argument "$string" isn't numeric in numeric eq (==) at ... |
32
|
|
|
|
|
|
|
# return 1 if defined $string && $string && $string == 0; |
33
|
|
|
|
|
|
|
|
34
|
9
|
|
|
|
|
179
|
$string =~ tr/A-Z/a-z/; |
35
|
9
|
100
|
100
|
|
|
83
|
return 1 if defined $string && $string && ($string eq '0e0' || $string eq '0 but true'); |
|
|
|
100
|
|
|
|
|
|
|
|
66
|
|
|
|
|
36
|
5
|
|
|
|
|
22
|
return; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |