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 146     146   80254 use strict;
  146         202  
  146         4480  
4              
5 146     146   482 use vars qw($VERSION);
  146         192  
  146         7445  
6             $VERSION = '1.370'; # NOTE - Should be #.### (three decimal places)
7              
8 146     146   579 use Carp qw(croak);
  146         227  
  146         51611  
9              
10             #------------------------------------------------------------------------------
11              
12             sub new {
13 1     1 1 130741 my $type = shift;
14 1         140 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 134     134 1 26597 my ($self, $stream) = @_;
23 134         156 my @return;
24              
25 134         312 $self->get_one_start($stream);
26 131         131 while (1) {
27 261         443 my $next = $self->get_one();
28 259 100       496 last unless @$next;
29 130         269 push @return, @$next;
30             }
31              
32 129         290 return \@return;
33             }
34              
35             sub clone {
36 7     7 1 1753 my $self = shift;
37 7 100       23 my $buf = (ref($self->[0]) eq 'ARRAY') ? [ ] : '';
38 7         25 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 2368     2368   4871 my( $type, $name, $default, $params ) = @_;
50             return $default # 512 MB
51 2368 100       5557 unless defined $params->{$name};
52              
53 26         31 my $ret = $params->{$name};
54 26 100       1249 croak "$name must be a number"
55             unless $ret =~ /^\d+$/;
56 17 100       459 croak "$name must greater then 0"
57             unless $ret > 0;
58 14         30 return $ret;
59             }
60              
61              
62             1;
63              
64             __END__