line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Function::Fallback::CoreOrPP::ScalarUtilNumeric; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2015-04-12'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.01'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
527
|
use 5.010001; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
7
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
8
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
406
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
require Exporter; |
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
13
|
|
|
|
|
|
|
isint |
14
|
|
|
|
|
|
|
isnum |
15
|
|
|
|
|
|
|
isnan |
16
|
|
|
|
|
|
|
isinf |
17
|
|
|
|
|
|
|
isneg |
18
|
|
|
|
|
|
|
isfloat |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub isint { |
22
|
6
|
|
|
6
|
1
|
11
|
local $_ = shift; |
23
|
6
|
100
|
|
|
|
15
|
return 0 unless defined; |
24
|
5
|
100
|
|
|
|
33
|
return 1 if /\A[+-]?(?:0|[1-9][0-9]*)\z/; |
25
|
2
|
|
|
|
|
4
|
0; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub isnan($) { |
29
|
13
|
|
|
13
|
1
|
16
|
local $_ = shift; |
30
|
13
|
100
|
|
|
|
19
|
return 0 unless defined; |
31
|
12
|
100
|
|
|
|
42
|
return 1 if /\A\s*[+-]?nan\s*\z/i; |
32
|
7
|
|
|
|
|
17
|
0; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub isinf($) { |
36
|
12
|
|
|
12
|
1
|
16
|
local $_ = shift; |
37
|
12
|
100
|
|
|
|
19
|
return 0 unless defined; |
38
|
11
|
100
|
|
|
|
50
|
return 1 if /\A\s*[+-]?inf(?:inity)?\s*\z/i; |
39
|
5
|
|
|
|
|
12
|
0; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub isneg($) { |
43
|
6
|
|
|
6
|
1
|
10
|
local $_ = shift; |
44
|
6
|
100
|
|
|
|
10
|
return 0 unless defined; |
45
|
5
|
100
|
|
|
|
21
|
return 1 if /\A\s*-/; |
46
|
2
|
|
|
|
|
3
|
0; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub isnum($) { |
50
|
12
|
|
|
12
|
1
|
25
|
goto &isfloat; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub isfloat($) { |
54
|
24
|
|
|
24
|
1
|
29
|
local $_ = shift; |
55
|
24
|
100
|
|
|
|
47
|
return 0 unless defined; |
56
|
22
|
100
|
|
|
|
137
|
return 1 if /\A[+-]?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\z/; |
57
|
8
|
100
|
100
|
|
|
10
|
return 1 if isnan($_) || isinf($_); |
58
|
4
|
|
|
|
|
9
|
0; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
# ABSTRACT: Pure-perl drop-in replacement/approximation of Scalar::Util::Numeric |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |