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