blib/lib/POE/Filter.pm

filter: Statementstmt 100% 31 / 31 Branchbran 100% 10 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 3 / 3 totaltotal 100% 51 / 51 CC 6 SCAR 8.5
CC
6
Cov
100%
__param_max
4.0
get
2.0
clone
2.0
CRAP 2.3
« blib/lib/POE/Loop/PerlSignals.pm ↑ Summary blib/lib/POE/Resource/Aliases.pm »
1 package POE::Filter;
2  
3 145 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 145 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 145 $VERSION = '1.368'; # NOTE - Should be #.### (three decimal places)
7  
8 145 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 #------------------------------------------------------------------------------
11  
12 sub new {
13 1 ▶ my $type = shift;
Subroutine new: called CC=1 SCAR=0.0
Pod documented
14 1 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 173 ▶ my ($self, $stream) = @_;
Subroutine get: called CC=2 SCAR=6.9
Pod documented
23 173 my @return;
24  
25 173 $self->get_one_start($stream);
26 170 while (1) {
27 300 my $next = $self->get_one();
28 298 ▶ last unless @$next;
Branch: 1 branch
BranchTrueFalseTotal
unless @$next 168 130 298
29 130 push @return, @$next;
30 }
31  
32 168 return \@return;
33 }
34  
35 sub clone {
36 7 ▶ my $self = shift;
Subroutine clone: called CC=2 SCAR=6.9
Pod documented
37 7 ▶ my $buf = (ref($self->[0]) eq 'ARRAY') ? [ ] : '';
Branch: 1 branch
BranchTrueFalseTotal
ref $self->[0] eq 'ARRAY' ? : 4 3 7
38 7 my $nself = bless [
39 $buf, # BUFFER
40 @$self[1..$#$self], # everything else
41 ], ref $self;
42 7 return $nself;
43 }
44  
45  
46 sub __param_max
47  
48 {
49 2364 ▶ my( $type, $name, $default, $params ) = @_;
Subroutine __param_max: called CC=4 SCAR=13.9
50 return $default # 512 MB
51 2364 ▶ unless defined $params->{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $params->{$name} 2338 26 2364
52  
53 26 my $ret = $params->{$name};
54 26 ▶ croak "$name must be a number"
Branch: 1 branch
BranchTrueFalseTotal
unless $ret =~ /^\d+$/ 9 17 26
55 unless $ret =~ /^\d+$/;
56 17 ▶ croak "$name must greater then 0"
Branch: 1 branch
BranchTrueFalseTotal
unless $ret > 0 3 14 17
57 unless $ret > 0;
58 14 return $ret;
59 }
60  
61  
62 145 1;
63  
64 __END__
« blib/lib/POE/Loop/PerlSignals.pm ↑ Summary blib/lib/POE/Resource/Aliases.pm »