line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Pipe::Repeat; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
40
|
use warnings; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
243
|
|
4
|
6
|
|
|
6
|
|
64
|
use strict; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
366
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
6
|
|
|
6
|
|
37
|
use base 'Text::Pipe::Base'; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
964
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
__PACKAGE__->mk_scalar_accessors(qw(times join)); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
6
|
|
|
|
|
1760
|
use constant DEFAULTS => ( |
17
|
|
|
|
|
|
|
times => 2, |
18
|
|
|
|
|
|
|
join => '', |
19
|
6
|
|
|
6
|
|
40
|
); |
|
6
|
|
|
|
|
14
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub filter_single { |
23
|
14
|
|
|
14
|
1
|
32
|
my ($self, $input) = @_; |
24
|
14
|
|
|
|
|
22
|
my $output = ''; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# temp variables in case we have to loop many times, in which case |
27
|
|
|
|
|
|
|
# repeated trips to the accessors would be inefficient. |
28
|
|
|
|
|
|
|
|
29
|
14
|
|
|
|
|
54
|
my $times = $self->times; |
30
|
14
|
|
|
|
|
119
|
my $join = $self->join; |
31
|
|
|
|
|
|
|
|
32
|
14
|
|
|
|
|
97
|
for (1..$times) { |
33
|
28
|
|
|
|
|
61
|
$output .= $input; |
34
|
28
|
100
|
|
|
|
114
|
$output .= $join unless $_ eq $times; |
35
|
|
|
|
|
|
|
} |
36
|
14
|
|
|
|
|
75
|
$output; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |