| 1 | package Net::HTTP2::Client::ConnectionPool; | ||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Net::HTTP2::Constants (); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 11 | 1 | my ($class, $io_name, $conn_opts_hr) = @_; | |||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||
| 13 | 1 | my $ns = "Net::HTTP2::Client::Connection::$io_name"; | |||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | if (!$ns->can('new')) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 16 | 1 | local $@; | |||||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | Carp::croak $@ if !eval "require $ns"; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||
| 20 | 1 | return bless { | |||||||||||||||||||||||||||||||||||||
| 21 | conn_ns => $ns, | ||||||||||||||||||||||||||||||||||||||
| 22 | conn_opts => $conn_opts_hr, | ||||||||||||||||||||||||||||||||||||||
| 23 | }, $class; | ||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||
| 26 | 2 | ▶ | sub get_connection { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
get_connection: called CC=4 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 27 | 2 | my ($self, $host, $port) = @_; | |||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||
| 29 | return $self->{'pool'}{$host}{$port || q<>} ||= $self->{'conn_ns'}->new( | ||||||||||||||||||||||||||||||||||||||
| 30 | $host, | ||||||||||||||||||||||||||||||||||||||
| 31 | 2 | ▶ | %{ $self->{'conn_opts'} }, | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
$self->{"pool"}{$host}{$port or ""} ||= $self->{"conn_ns"}->new($host, %{$$self{"conn_opts"};}, $port == 443 ? () : ("port", $port))
$port || ''
MC/DC0%0/2
$self->{"pool"}{$host}{$port or ""} ||= $self->{"conn_ns"}->new($host, %{$$self{"conn_opts"};}, $port == 443 ? () : ("port", $port))
$self->{"pool"}{$host}{$port or ""}
$self->{"conn_ns"}->new($host, %{$$self{"conn_opts"};}, $port == 443 ? () : ("port", $port))
MC/DC0%0/1
$port || ''
$port
Truth table33%1/3
A ||= B
A= $self->{"pool"}{$host}{$port or ""}B= $self->{"conn_ns"}->new($host, %{$$self{"conn_opts"};}, $port == 443 ? () : ("port", $port))
Truth table50%1/2
A
A= $port
| |||||||||||||||||||||||||||||||||||||||
| 32 | ($port == Net::HTTP2::Constants::HTTPS_PORT ? () : (port => $port)), | ||||||||||||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||
| 36 | 1 | 1; | |||||||||||||||||||||||||||||||||||||