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