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 140     140   734 use warnings;
  140         192  
  140         6652  
3 140     140   556 use strict;
  140         185  
  140         3078  
4 140     140   460 use Carp qw/croak/;
  140         165  
  140         7203  
5 140     140   2509 use IO::Socket::INET;
  140         72317  
  140         1570  
6              
7             sub new {
8 0     0 1 0 croak "Cannot instantiate Feersum::Connection directly";
9             }
10              
11             sub _initiate_streaming_psgi {
12 17     17   183708 my ($self, $streamer) = @_;
13 17     8   121 return $streamer->(sub { $self->_continue_streaming_psgi(@_) });
  8         960259  
14             }
15              
16             my $_pkg = "Feersum::";
17             sub _raw { ## no critic (RequireArgUnpacking)
18             # don't shift; want to modify $_[0] directly.
19 21     21   6517055 my $fileno = $_[1];
20 21         108 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 140     140   77096 no warnings 'redefine';
  140         291  
  140         7614  
24             local *IO::Handle::gensym = sub {
25 140     140   610 no strict;
  140         640  
  140         14990  
26 21     21   218 my $gv = \*{$_pkg.$name};
  21         681  
27 21         109 delete $$_pkg{$name};
28 21         112 $gv;
29 21         2013 };
30             # Replace $_[0] directly:
31 21         548 $_[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         3001 return;
35             }
36             1;
37             __END__