File Coverage

blib/lib/Feersum/Connection.pm
Criterion Covered Total %
statement 30 31 96.7
branch n/a
condition n/a
subroutine 10 11 90.9
pod 1 1 100.0
total 41 43 95.3


line stmt bran cond sub pod time code
1             package Feersum::Connection;
2 139     139   775 use warnings;
  139         212  
  139         6703  
3 139     139   582 use strict;
  139         181  
  139         2709  
4 139     139   447 use Carp qw/croak/;
  139         193  
  139         6976  
5 139     139   2871 use IO::Socket::INET;
  139         85546  
  139         1426  
6              
7             sub new {
8 0     0 1 0 croak "Cannot instantiate Feersum::Connection directly";
9             }
10              
11             sub _initiate_streaming_psgi {
12 16     16   183135 my ($self, $streamer) = @_;
13 16     7   125 return $streamer->(sub { $self->_continue_streaming_psgi(@_) });
  7         1304933  
14             }
15              
16             my $_pkg = "Feersum::";
17             sub _raw { ## no critic (RequireArgUnpacking)
18             # don't shift; want to modify $_[0] directly.
19 21     21   6663327 my $fileno = $_[1];
20 21         247 my $name = "RAW$fileno";
21             # Hack to make gensyms via new_from_fd() show up in the Feersum package.
22             # This may or may not save memory (HEKs?) over true gensyms.
23 139     139   77800 no warnings 'redefine';
  139         270  
  139         7245  
24             local *IO::Handle::gensym = sub {
25 139     139   601 no strict;
  139         655  
  139         15177  
26 21     21   199 my $gv = \*{$_pkg.$name};
  21         473  
27 21         114 delete $$_pkg{$name};
28 21         64 $gv;
29 21         2524 };
30             # Replace $_[0] directly:
31 21         607 $_[0] = IO::Socket::INET->new_from_fd($fileno, '+<');
32             # after this, Feersum will use PerlIO_unread to put any remainder data
33             # into the socket.
34 21         3104 return;
35             }
36             1;
37             __END__