File Coverage

blib/lib/String/Normal/Type.pm
Criterion Covered Total %
statement 35 35 100.0
branch n/a
condition n/a
subroutine 11 11 100.0
pod n/a
total 46 46 100.0


line stmt bran cond sub pod time code
1             package String::Normal::Type;
2 9     9   33 use strict;
  9         9  
  9         199  
3 9     9   26 use warnings;
  9         9  
  9         170  
4              
5 9     9   3080 use String::Normal::Type::Business;
  9         15  
  9         210  
6 9     9   3301 use String::Normal::Type::Address;
  9         14  
  9         189  
7 9     9   2923 use String::Normal::Type::Phone;
  9         10  
  9         184  
8 9     9   2877 use String::Normal::Type::State;
  9         13  
  9         178  
9 9     9   2878 use String::Normal::Type::City;
  9         12  
  9         181  
10 9     9   3106 use String::Normal::Type::Zip;
  9         14  
  9         184  
11 9     9   2877 use String::Normal::Type::Title;
  9         12  
  9         782  
12              
13             sub _scrub_value {
14 23     23   26 my $value = shift;
15              
16 23         31 $value = _deaccent_value( $value );
17 23         22 $value =~ tr/'//d;
18              
19             # replace all rejected charactes with space
20 23         80 $value =~ s/[^a-z0-9#]/ /g;
21              
22 23         45 return $value
23             }
24              
25             sub _deaccent_value {
26 23     23   17 my $value = shift;
27              
28             # remove decorations and stem variations of single quotes
29 23         31 $value =~ tr[àáâãäåæçèéêëìíîïñòóôõöøùúûüýÿ’`\x92]
30             [aaaaaaaceeeeiiiinoooooouuuuyy'''];
31              
32 23         30 return $value;
33             }
34              
35             1;
36              
37             __END__