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 141     141   807 use warnings;
  141         212  
  141         7060  
3 141     141   565 use strict;
  141         203  
  141         2853  
4 141     141   450 use Carp qw/croak/;
  141         213  
  141         7003  
5 141     141   2892 use IO::Socket::INET;
  141         74325  
  141         1599  
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   182994 my ($self, $streamer) = @_;
13 17     8   124 return $streamer->(sub { $self->_continue_streaming_psgi(@_) });
  8         1103542  
14             }
15              
16             my $_pkg = "Feersum::";
17             sub _raw { ## no critic (RequireArgUnpacking)
18             # don't shift; want to modify $_[0] directly.
19 21     21   6471421 my $fileno = $_[1];
20 21         128 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 141     141   80225 no warnings 'redefine';
  141         355  
  141         7916  
24             local *IO::Handle::gensym = sub {
25 141     141   592 no strict;
  141         650  
  141         15451  
26 21     21   238 my $gv = \*{$_pkg.$name};
  21         375  
27 21         66 delete $$_pkg{$name};
28 21         67 $gv;
29 21         2828 };
30             # Replace $_[0] directly:
31 21         799 $_[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         2849 return;
35             }
36             1;
37             __END__