line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Sah::Filter::perl::Str::remove_whitespace; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20
|
use 5.010001; |
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
204
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
8
|
|
|
|
|
|
|
our $DATE = '2023-06-21'; # DATE |
9
|
|
|
|
|
|
|
our $DIST = 'Data-Sah-Filter'; # DIST |
10
|
|
|
|
|
|
|
our $VERSION = '0.021'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub meta { |
13
|
|
|
|
|
|
|
+{ |
14
|
4
|
|
|
4
|
0
|
35
|
v => 1, |
15
|
|
|
|
|
|
|
summary => 'Remove whitespaces from string', |
16
|
|
|
|
|
|
|
description => <<'_', |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Tabs and newlines will also be removed. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
_ |
21
|
|
|
|
|
|
|
args => { |
22
|
|
|
|
|
|
|
}, |
23
|
|
|
|
|
|
|
examples => [ |
24
|
|
|
|
|
|
|
{value=>"foo"}, |
25
|
|
|
|
|
|
|
{value=>"foo bar ", filtered_value=>"foobar"}, |
26
|
|
|
|
|
|
|
{value=>" foo \t bar \n ", filtered_value=>"foobar", summary=>"Tabs and newlines will also be removed"}, |
27
|
|
|
|
|
|
|
], |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub filter { |
32
|
4
|
|
|
4
|
0
|
10
|
my %fargs = @_; |
33
|
|
|
|
|
|
|
|
34
|
4
|
|
|
|
|
10
|
my $dt = $fargs{data_term}; |
35
|
|
|
|
|
|
|
#my $gen_args = $fargs{args} // {}; |
36
|
|
|
|
|
|
|
|
37
|
4
|
|
|
|
|
7
|
my $res = {}; |
38
|
4
|
|
|
|
|
10
|
$res->{expr_filter} = join( |
39
|
|
|
|
|
|
|
"", |
40
|
|
|
|
|
|
|
"do { my \$tmp = $dt; \$tmp =~ s/\\s+//gs; \$tmp }", |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
4
|
|
|
|
|
12
|
$res; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
# ABSTRACT: Remove whitespaces from string |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |