blib/lib/POE/Filter/Stream.pm

filter: Statementstmt 100% 31 / 31 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 6 / 6 totaltotal 100% 50 / 50 CC 3 SCAR 3.1
CC
3
Cov
100%
get_one
2.0
get_pending
2.0
BEGIN
1.0
CRAP 1.4
« blib/lib/POE/Resource/SIDs.pm ↑ Summary blib/lib/POE/Wheel.pm »
1 package POE::Filter::Stream;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use POE::Filter;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use vars qw($VERSION @ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 $VERSION = '1.370'; # NOTE - Should be #.### (three decimal places)
8 4 @ISA = qw(POE::Filter);
9  
10 #------------------------------------------------------------------------------
11  
12 9 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
13 9 my $type = shift;
14 9 my $buffer = '';
15 9 my $self = bless \$buffer, $type;
16 9 $self;
17 }
18  
19 1 ▶sub clone {
Subroutine clone: called CC=1 SCAR=0.0
Pod documented
20 1 my $self = shift;
21 1 my $buffer = '';
22 1 my $clone = bless \$buffer, ref $self;
23 }
24  
25 #------------------------------------------------------------------------------
26 # get() is inherited from POE::Filter.
27  
28 #------------------------------------------------------------------------------
29 # 2001-07-27 RCC: The get_one() variant of get() allows Wheel::Xyz to
30 # retrieve one filtered block at a time. This is necessary for filter
31 # changing and proper input flow control. Although it's kind of
32 # pointless for Stream, but it has to follow the proper interface.
33  
34 20 ▶sub get_one_start {
Subroutine get_one_start: called CC=1 SCAR=0.0
Pod documented
35 20 my ($self, $stream) = @_;
36 20 $$self .= join '', @$stream;
37 }
38  
39 40 ▶sub get_one {
Subroutine get_one: called CC=2 SCAR=6.9
Pod documented
40 40 my $self = shift;
41 40 ▶ return [ ] unless length $$self;
Branch: 1 branch
BranchTrueFalseTotal
unless length $$self 20 20 40
42 20 my $chunk = $$self;
43 20 $$self = '';
44 20 return [ $chunk ];
45 }
46  
47 #------------------------------------------------------------------------------
48  
49 18 ▶sub put {
Subroutine put: called CC=1 SCAR=0.0
Pod documented
50 18 my ($self, $chunks) = @_;
51 18 [ @$chunks ];
52 }
53  
54 #------------------------------------------------------------------------------
55  
56 12 ▶sub get_pending {
Subroutine get_pending: called CC=2 SCAR=6.9
Pod documented
57 12 my $self = shift;
58 12 ▶ return [ $$self ] if length $$self;
Branch: 1 branch
BranchTrueFalseTotal
if length $$self 2 10 12
59 10 return undef;
60 }
61  
62 4 1;
63  
64 __END__
« blib/lib/POE/Resource/SIDs.pm ↑ Summary blib/lib/POE/Wheel.pm »