line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Pipe::Base; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
37
|
use warnings; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
379
|
|
4
|
8
|
|
|
8
|
|
36
|
use strict; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
245
|
|
5
|
8
|
|
|
8
|
|
7899
|
use UNIVERSAL::require; |
|
8
|
|
|
|
|
15174
|
|
|
8
|
|
|
|
|
82
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
8
|
|
|
8
|
|
431
|
use base qw(Class::Accessor::Complex Class::Accessor::Constructor); |
|
8
|
|
|
|
|
25
|
|
|
8
|
|
|
|
|
10828
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use overload |
15
|
8
|
|
|
|
|
68
|
'|' => 'bit_or', |
16
|
8
|
|
|
8
|
|
393541
|
fallback => 1; |
|
8
|
|
|
|
|
24
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
__PACKAGE__->mk_constructor; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# so subclasses can call SUPER::init(@_) |
23
|
63
|
|
|
63
|
1
|
91715
|
sub init {} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub filter_single { |
27
|
0
|
|
|
0
|
1
|
0
|
my ($self, $input) = @_; |
28
|
0
|
|
|
|
|
0
|
$input; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub filter { |
33
|
66
|
|
|
66
|
1
|
451
|
my ($self, $input) = @_; |
34
|
|
|
|
|
|
|
|
35
|
66
|
100
|
|
|
|
219
|
if (ref $input eq 'ARRAY') { |
36
|
1
|
|
|
|
|
2
|
return [ map { $self->filter_single($_) } @$input ]; |
|
3
|
|
|
|
|
9
|
|
37
|
|
|
|
|
|
|
} else { |
38
|
65
|
|
|
|
|
252
|
return $self->filter_single($input); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub bit_or { |
45
|
4
|
|
|
4
|
1
|
1064
|
my ($lhs, $rhs) = @_; |
46
|
|
|
|
|
|
|
|
47
|
4
|
50
|
33
|
|
|
56
|
die "can only stack pipe segments" unless |
48
|
|
|
|
|
|
|
UNIVERSAL::isa($lhs, 'Text::Pipe::Base') && |
49
|
|
|
|
|
|
|
UNIVERSAL::isa($rhs, 'Text::Pipe::Base'); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# even if either side is a Text::Pipe::Stackable already, don't push or |
52
|
|
|
|
|
|
|
# unshift because we don't want to alter the original pipes. So we'd |
53
|
|
|
|
|
|
|
# rather create nested pipes. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# don't use() it because Text::Pipe::Stackable inherits from this class |
56
|
4
|
|
|
|
|
48
|
Text::Pipe::Stackable->require; |
57
|
4
|
|
|
|
|
123
|
Text::Pipe::Stackable->new($lhs, $rhs); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |