line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Validator::LIVR::Rules::Filters; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
150
|
|
4
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
1875
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.09'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub trim { |
9
|
|
|
|
|
|
|
return sub { |
10
|
5
|
|
|
5
|
|
5
|
my ( $value, undef, $output_ref ) = @_; |
11
|
5
|
100
|
66
|
|
|
24
|
return if !defined($value) || ref($value) || $value eq ''; |
|
|
|
66
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
|
|
5
|
$$output_ref = $value; |
14
|
4
|
|
|
|
|
11
|
$$output_ref =~ s/^\s*//; |
15
|
4
|
|
|
|
|
12
|
$$output_ref =~ s/\s*$//; |
16
|
|
|
|
|
|
|
|
17
|
4
|
|
|
|
|
5
|
return; |
18
|
3
|
|
|
3
|
0
|
24
|
}; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub to_lc { |
22
|
|
|
|
|
|
|
return sub { |
23
|
6
|
|
|
6
|
|
6
|
my ( $value, undef, $output_ref ) = @_; |
24
|
6
|
100
|
66
|
|
|
29
|
return if !defined($value) || ref($value) || $value eq ''; |
|
|
|
66
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
5
|
|
|
|
|
7
|
$$output_ref = lc($value); |
27
|
5
|
|
|
|
|
7
|
return; |
28
|
4
|
|
|
4
|
0
|
25
|
}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub to_uc { |
32
|
|
|
|
|
|
|
return sub { |
33
|
5
|
|
|
5
|
|
5
|
my ( $value, undef, $output_ref ) = @_; |
34
|
5
|
100
|
66
|
|
|
27
|
return if !defined($value) || ref($value) || $value eq ''; |
|
|
|
66
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
4
|
|
|
|
|
5
|
$$output_ref = uc($value); |
37
|
4
|
|
|
|
|
6
|
return; |
38
|
3
|
|
|
3
|
0
|
21
|
}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub remove { |
42
|
3
|
|
|
3
|
0
|
3
|
my $chars = shift; |
43
|
3
|
|
|
|
|
35
|
my $re = qr/[\Q$chars\E]/; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
return sub { |
46
|
5
|
|
|
5
|
|
4
|
my ( $value, undef, $output_ref ) = @_; |
47
|
5
|
100
|
66
|
|
|
27
|
return if !defined($value) || ref($value) || $value eq ''; |
|
|
|
66
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
4
|
|
|
|
|
16
|
$value =~ s/$re//g; |
50
|
|
|
|
|
|
|
|
51
|
4
|
|
|
|
|
9
|
$$output_ref = $value; |
52
|
4
|
|
|
|
|
7
|
return; |
53
|
3
|
|
|
|
|
22
|
}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub leave_only { |
57
|
3
|
|
|
3
|
0
|
4
|
my $chars = shift; |
58
|
3
|
|
|
|
|
36
|
my $re = qr/[^\Q$chars\E]/; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
return sub { |
61
|
5
|
|
|
5
|
|
5
|
my ( $value, undef, $output_ref ) = @_; |
62
|
5
|
100
|
66
|
|
|
24
|
return if !defined($value) || ref($value) || $value eq ''; |
|
|
|
66
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
4
|
|
|
|
|
23
|
$value =~ s/$re//g; |
65
|
|
|
|
|
|
|
|
66
|
4
|
|
|
|
|
6
|
$$output_ref = $value; |
67
|
4
|
|
|
|
|
6
|
return; |
68
|
3
|
|
|
|
|
24
|
}; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |