File Coverage

blib/lib/Data/Sah/Filter/perl/Str/remove_non_latin_alphanum.pm
Criterion Covered Total %
statement 8 14 57.1
branch n/a
condition n/a
subroutine 3 5 60.0
pod 0 2 0.0
total 11 21 52.3


line stmt bran cond sub pod time code
1             package Data::Sah::Filter::perl::Str::remove_non_latin_alphanum;
2              
3 1     1   495119 use 5.010001;
  1         5  
4 1     1   10 use strict;
  1         2  
  1         39  
5 1     1   7 use warnings;
  1         2  
  1         342  
6              
7             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
8             our $DATE = '2024-07-17'; # DATE
9             our $DIST = 'Data-Sah-Filter'; # DIST
10             our $VERSION = '0.025'; # VERSION
11              
12             sub meta {
13             +{
14 0     0 0   v => 1,
15             summary => 'Remove characters that are not [A-Za-z0-9]',
16             examples => [
17             {value=>"aBc123"},
18             {value=>"aBc 123..4_56", filtered_value=>"aBc123456"},
19             ],
20             };
21             }
22              
23             sub filter {
24 0     0 0   my %fargs = @_;
25              
26 0           my $dt = $fargs{data_term};
27              
28 0           my $res = {};
29 0           $res->{expr_filter} = join(
30             "",
31             "do { ", (
32             "my \$tmp = $dt; ",
33             "\$tmp =~ s/[^A-Za-z0-9]+//g; ",
34             "\$tmp ",
35             ), "}",
36             );
37              
38 0           $res;
39             }
40              
41             1;
42             # ABSTRACT: Remove characters that are not [A-Za-z0-9]
43              
44             __END__