blib/lib/Feersum/Connection/Handle.pm

filter: Statementstmt 71.7% 38 / 53 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 15 / 25 Podpod 0.0% 0 / 2 totaltotal 61.6% 53 / 86 CC 7 SCAR 12.4
CC
7
Cov
64%
getlines
12.0
getlines
12.0
_diamond
6.0
CRAP 3.5
« blib/lib/Feersum.pm ↑ Summary blib/lib/Plack/Handler/Feersum.pm »
1 package Feersum::Connection::Handle;
2 374 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 374 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 374 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
7 0 ▶ Carp::croak "Cannot instantiate Feersum::Connection::Handle directly";
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
8 }
9  
10 package Feersum::Connection::Reader;
11 374 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 374 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 374 ▶use base 'Feersum::Connection::Handle';
Subroutine BEGIN: called CC=1 SCAR=0.0
14 374 ▶use Scalar::Util ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15 # all three conversions explicit: a missing one is generated from the others, and
16 # bool alone made every reader stringify and numify to 1
17 use overload
18 374 ▶ '<>' => \&_diamond,
Subroutine BEGIN: called CC=1 SCAR=0.4
19 27 ▶ 'bool' => sub { 1 },
Subroutine __ANON__: called CC=1 SCAR=0.0
20 0 ▶ '""' => sub { overload::StrVal($_[0]) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
21 0 ▶ '0+' => sub { Scalar::Util::refaddr($_[0]) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
22 374 fallback => 1;
23  
24 1 ▶sub write { ## no critic (BuiltinHomonyms)
Subroutine write: called CC=1 SCAR=0.0
25 1 Carp::croak "can't call write() on a read-only handle" }
26 1 ▶sub write_array {
Subroutine write_array: called CC=1 SCAR=0.0
27 1 Carp::croak "can't call write_array() on a read-only handle" }
28 1 ▶sub sendfile {
Subroutine sendfile: called CC=1 SCAR=0.0
29 1 Carp::croak "can't call sendfile() on a read-only handle" }
30  
31 0 ▶sub getlines {
Subroutine getlines: not called CC=3 SCAR=24.8
32 0 my $self = shift;
33 0 ▶ Carp::croak "getlines() called in scalar context" unless wantarray;
Branch: 1 branch
BranchTrueFalseTotal
unless wantarray 0 0 0
34 0 my (@lines, $line);
35 0 ▶ push @lines, $line while defined($line = $self->getline);
Branch: 1 branch
BranchTrueFalseTotal
defined($line = $self->getline) and do { push @lines, $line } 0 0 0
36 0 return @lines;
37 }
38  
39 # <> is called in the op's context, so wantarray here is deliberate
40 0 ▶sub _diamond {
Subroutine _diamond: not called CC=2 SCAR=17.9
41 0 my $self = shift;
42 0 ▶ return wantarray ? $self->getlines : $self->getline;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
43 }
44  
45 package Feersum::Connection::Writer;
46 374 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
47 374 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
48 374 ▶use base 'Feersum::Connection::Handle';
Subroutine BEGIN: called CC=1 SCAR=0.0
49  
50 0 ▶sub read { ## no critic (BuiltinHomonyms)
Subroutine read: not called CC=1 SCAR=6.9
51 0 Carp::croak "can't call read() on a write-only handle" }
52 0 ▶sub seek { ## no critic (BuiltinHomonyms)
Subroutine seek: not called CC=1 SCAR=6.9
53 0 Carp::croak "can't call seek() on a write-only handle" }
54 0 ▶sub getline {
Subroutine getline: not called CC=1 SCAR=6.9
55 0 Carp::croak "can't call getline() on a write-only handle" }
56 0 ▶sub getlines {
Subroutine getlines: not called CC=1 SCAR=6.9
57 0 Carp::croak "can't call getlines() on a write-only handle" }
58  
59 package Feersum::Connection::Handle;
60 374 1;
61 __END__
« blib/lib/Feersum.pm ↑ Summary blib/lib/Plack/Handler/Feersum.pm »