line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Pipe::Split; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use base 'Text::Pipe::Base'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
264
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
__PACKAGE__->mk_scalar_accessors(qw(pattern limit)); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub filter { |
17
|
4
|
|
|
4
|
1
|
21
|
my ($self, $input) = @_; |
18
|
|
|
|
|
|
|
|
19
|
4
|
50
|
|
|
|
13
|
return $input if ref $input; |
20
|
|
|
|
|
|
|
|
21
|
4
|
|
|
|
|
48
|
my $pattern = $self->pattern; |
22
|
4
|
100
|
|
|
|
407
|
$pattern = '' unless defined $pattern; |
23
|
|
|
|
|
|
|
|
24
|
4
|
|
|
|
|
14
|
my $limit = $self->limit; |
25
|
4
|
100
|
|
|
|
24
|
$limit = 0 unless defined $limit; |
26
|
|
|
|
|
|
|
|
27
|
4
|
|
|
|
|
76
|
[ split /$pattern/ => $input, $limit ]; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |