Lib-Log4cplus
view release on metacpan or search on metacpan
inc/inc_Config-AutoConf/Config/AutoConf.pm view on Meta::CPAN
sub looks_like_number {
local $_ = shift;
# checks from perlfaq4
return 0 if !defined($_);
if (ref($_)) {
return overload::Overloaded($_) ? defined(0 + $_) : 0;
}
return 1 if (/^[+-]?[0-9]+$/); # is a +/- integer
return 1 if (/^([+-]?)(?=[0-9]|\.[0-9])[0-9]*(\.[0-9]*)?([Ee]([+-]?[0-9]+))?$/); # a C float
return 1 if ($] >= 5.008 and /^(Inf(inity)?|NaN)$/i) or ($] >= 5.006001 and /^Inf$/i);
0;
}
EOP
eval "use File::Slurp::Tiny qw/read_file/;";
__PACKAGE__->can("read_file") or eval <<'EOP';
=begin private
=head2 read_file
s++; if (s == send || (*s != 'F' && *s != 'f')) return 0;
s++; if (s < send && (*s == 'I' || *s == 'i')) {
s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
s++; if (s == send || (*s != 'I' && *s != 'i')) return 0;
s++; if (s == send || (*s != 'T' && *s != 't')) return 0;
s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
s++;
}
sawinf = 1;
} else if (*s == 'N' || *s == 'n') {
/* XXX TODO: There are signaling NaNs and quiet NaNs. */
s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
s++;
sawnan = 1;
} else
return 0;
if (sawinf) {
numtype &= IS_NUMBER_NEG; /* Keep track of sign */
numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT;
( run in 0.475 second using v1.01-cache-2.11-cpan-fd5d4e115d8 )