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 32     32   278 use Perlmazing qw(define not_empty);
  32         83  
  32         176  
2 32     32   211 use Scalar::Util qw(looks_like_number);
  32         86  
  32         2404  
3              
4             sub main ($) {
5 0     0     my $i = shift;
6 32     32   221 no warnings;
  32         80  
  32         8237  
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