File Coverage

blib/lib/POE/Filter.pm
Criterion Covered Total %
statement 29 29 100.0
branch 10 10 100.0
condition n/a
subroutine 7 7 100.0
pod 3 3 100.0
total 49 49 100.0


line stmt bran cond sub pod time code
1             package POE::Filter;
2              
3 111     111   29166 use strict;
  111         185  
  111         4938  
4              
5 111     111   587 use vars qw($VERSION);
  111         148  
  111         6671  
6             $VERSION = '1.367'; # NOTE - Should be #.### (three decimal places)
7              
8 111     111   551 use Carp qw(croak);
  111         160  
  111         53803  
9              
10             #------------------------------------------------------------------------------
11              
12             sub new {
13 1     1 1 14 my $type = shift;
14 1         286 croak "$type is not meant to be used directly";
15             }
16              
17             # Return all the messages possible to parse in the current input
18             # buffer. This uses the newer get_one_start() and get_one(), which is
19             # implementation dependent.
20              
21             sub get {
22 140     140 1 29801 my ($self, $stream) = @_;
23 140         188 my @return;
24              
25 140         394 $self->get_one_start($stream);
26 137         141 while (1) {
27 267         592 my $next = $self->get_one();
28 265 100       702 last unless @$next;
29 130         265 push @return, @$next;
30             }
31              
32 135         450 return \@return;
33             }
34              
35             sub clone {
36 7     7 1 2236 my $self = shift;
37 7 100       24 my $buf = (ref($self->[0]) eq 'ARRAY') ? [ ] : '';
38 7         35 my $nself = bless [
39             $buf, # BUFFER
40             @$self[1..$#$self], # everything else
41             ], ref $self;
42 7         16 return $nself;
43             }
44              
45              
46             sub __param_max
47              
48             {
49 2224     2224   3648 my( $type, $name, $default, $params ) = @_;
50 2224 100       7241 return $default # 512 MB
51             unless defined $params->{$name};
52              
53 26         38 my $ret = $params->{$name};
54 26 100       1587 croak "$name must be a number"
55             unless $ret =~ /^\d+$/;
56 17 100       475 croak "$name must greater then 0"
57             unless $ret > 0;
58 14         34 return $ret;
59             }
60              
61              
62             1;
63              
64             __END__