File Coverage

lib/Perlmazing/Perlmazing/Precompile/is_number.pm
Criterion Covered Total %
statement 9 16 56.2
branch 0 8 0.0
condition n/a
subroutine 3 4 75.0
pod n/a
total 12 28 42.8


line stmt bran cond sub pod time code
1 31     31   326 use Perlmazing;
  31         78  
  31         178  
2 31     31   269 use Scalar::Util qw(looks_like_number);
  31         72  
  31         3120  
3            
4             sub main ($) {
5 0     0     my $i = shift;
6 31     31   267 no warnings;
  31         93  
  31         7679  
7 0 0         return 0 unless not_empty($i);
8 0 0         return 0 if $i =~ /[;:\s\n&=\$%\@\(\)\*]/;
9 0 0         return 0 if $i =~ /[^e][\+\-]/;
10 0 0         return 1 if $i =~ /^0x\d+$/i; # Not detected by Scalar::Util
11 0           $i =~ s/(\d)_(\d)/$1$2/g; # Also not accepted by Scalar::Util
12 0           define looks_like_number $i;;
13             }
14