| 1 | package Feersum::Connection; | ||
| 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 qw/croak/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 374 | ▶ | use IO::Socket::INET; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 0 | ▶ | sub new { |
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 8 | 0 | ▶ | croak "Cannot instantiate Feersum::Connection directly"; |
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 9 | } | ||
| 10 | |||
| 11 | 316 | ▶ | sub _initiate_streaming_psgi { |
|
Subroutine
_initiate_streaming_psgi: called CC=1 SCAR=0.6
| |||
| 12 | 0 | ▶ | my ($self, $streamer) = @_; |
|
Subroutine
_initiate_streaming_psgi: not called CC=1 SCAR=0.6
| |||
| 13 | 0 | ▶ | return $streamer->(sub { $self->_continue_streaming_psgi(@_) }); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.4
| |||
| 14 | } | ||
| 15 | |||
| 16 | 374 | my $_pkg = "Feersum::"; | |
| 17 | 24 | ▶ | sub _raw { ## no critic (RequireArgUnpacking) |
|
Subroutine
_raw: called CC=1 SCAR=0.0
| |||
| 18 | # don't shift; want to modify $_[0] directly. | ||
| 19 | 24 | my $fileno = $_[1]; | |
| 20 | 24 | my $name = "RAW$fileno"; | |
| 21 | # make new_from_fd's gensym live in the Feersum package | ||
| 22 | 374 | ▶ | no warnings 'redefine'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 23 | 24 | ▶ | local *IO::Handle::gensym = sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 24 | 374 | ▶ | no strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 25 | 24 | my $gv = \*{$_pkg.$name}; | |
| 26 | 24 | delete $$_pkg{$name}; | |
| 27 | 24 | $gv; | |
| 28 | 24 | }; | |
| 29 | 24 | $_[0] = IO::Socket::INET->new_from_fd($fileno, '+<'); | |
| 30 | # Feersum then PerlIO_unread()s any buffered remainder into it | ||
| 31 | 24 | return; | |
| 32 | } | ||
| 33 | 374 | 1; | |
| 34 | __END__ | ||