File Coverage

lib/Perlmazing/Perlmazing/Precompile/is_number.pm
Criterion Covered Total %
statement 16 16 100.0
branch 7 8 87.5
condition n/a
subroutine 4 4 100.0
pod n/a
total 27 28 96.4


line stmt bran cond sub pod time code
1 50     50   435 use Perlmazing;
  50         119  
  50         273  
2 50     50   374 use Scalar::Util qw(looks_like_number);
  50         123  
  50         4807  
3            
4             sub main ($) {
5 786     786   7549 my $i = shift;
6 50     50   399 no warnings;
  50         131  
  50         10552  
7 786 100       1390 return 0 unless not_empty($i);
8 774 100       2711 return 0 if $i =~ /[;:\s\n&=\$%\@\(\)\*]/;
9 384 50       1079 return 0 if $i =~ /[^e][\+\-]/;
10 384 100       766 return 1 if $i =~ /^0x\d+$/i; # Not detected by Scalar::Util
11 383         750 $i =~ s/_//g; # Also not accepted by Scalar::Util
12 383         1741 looks_like_number $i;;
13             }
14