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 147 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 147 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 147 $VERSION = '1.370'; # NOTE - Should be #.### (three decimal places)
7  
8 147 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 #------------------------------------------------------------------------------
11  
12 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
13 1 my $type = shift;
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 134 ▶sub get {
Subroutine get: called CC=2 SCAR=6.9
Pod documented
22 134 my ($self, $stream) = @_;
23 134 my @return;
24  
25 134 $self->get_one_start($stream);
26 131 while (1) {
27 261 my $next = $self->get_one();
28 259 ▶ last unless @$next;
Branch: 1 branch
BranchTrueFalseTotal
unless @$next 129 130 259
29 130 push @return, @$next;
30 }
31  
32 129 return \@return;
33 }
34  
35 7 ▶sub clone {
Subroutine clone: called CC=2 SCAR=6.9
Pod documented
36 7 my $self = shift;
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 2391 ▶{
Subroutine __param_max: called CC=4 SCAR=13.9
49 2391 my( $type, $name, $default, $params ) = @_;
50 return $default # 512 MB
51 2391 ▶ unless defined $params->{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $params->{$name} 2364 27 2391
52  
53 27 my $ret = $params->{$name};
54 27 ▶ croak "$name must be a number"
Branch: 1 branch
BranchTrueFalseTotal
unless $ret =~ /^\d+$/ 9 18 27
55 unless $ret =~ /^\d+$/;
56 18 ▶ croak "$name must greater then 0"
Branch: 1 branch
BranchTrueFalseTotal
unless $ret > 0 3 15 18
57 unless $ret > 0;
58 15 return $ret;
59 }
60  
61  
62 147 1;
63  
64 __END__
« blib/lib/POE/Loop/PerlSignals.pm ↑ Summary blib/lib/POE/Resource/Aliases.pm »