line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
795
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
182
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTML::FormFu::Filter::Split; |
4
|
|
|
|
|
|
|
$HTML::FormFu::Filter::Split::VERSION = '2.07'; |
5
|
|
|
|
|
|
|
# ABSTRACT: filter splitting a singe value into an arrayref |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
19
|
use Moose; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
22
|
|
8
|
3
|
|
|
3
|
|
21187
|
use MooseX::Attribute::Chained; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
613
|
|
9
|
|
|
|
|
|
|
extends 'HTML::FormFu::Filter'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has regex => ( is => 'rw', traits => ['Chained'] ); |
12
|
|
|
|
|
|
|
has limit => ( is => 'rw', traits => ['Chained'] ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub filter { |
15
|
14
|
|
|
14
|
0
|
41
|
my ( $self, $value ) = @_; |
16
|
|
|
|
|
|
|
|
17
|
14
|
50
|
|
|
|
29
|
return if !defined $value; |
18
|
|
|
|
|
|
|
|
19
|
14
|
|
|
|
|
427
|
my $regex = $self->regex; |
20
|
14
|
|
100
|
|
|
370
|
my $limit = $self->limit || 0; |
21
|
|
|
|
|
|
|
|
22
|
14
|
100
|
|
|
|
31
|
$regex = '' if !defined $regex; |
23
|
|
|
|
|
|
|
|
24
|
14
|
|
|
|
|
87
|
my @values = split /$regex/, $value, $limit; |
25
|
|
|
|
|
|
|
|
26
|
14
|
100
|
|
|
|
44
|
return if !@values; |
27
|
|
|
|
|
|
|
|
28
|
6
|
|
|
|
|
20
|
return \@values; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=pod |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=encoding UTF-8 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
HTML::FormFu::Filter::Split - filter splitting a singe value into an arrayref |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 VERSION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
version 2.07 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
type: Split |
52
|
|
|
|
|
|
|
regex: '-' |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Split a single input value into an arrayref of values. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 METHODS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 regex |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
A regex object or string to be passed as the C<PATTERN> argument to C<split>. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Default Value: '' (empty string) |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 limit |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
A number passed as the C<LIMIT> argument to C<split>. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Default Value: 0 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Carl Franks, C<cfranks@cpan.org> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 LICENSE |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
79
|
|
|
|
|
|
|
the same terms as Perl itself. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 AUTHOR |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Carl Franks <cpan@fireartist.com> |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Carl Franks. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
90
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |