HTTP2/Client/ConnectionPool.pm

filter: Statementstmt 100% 22 / 22 Branchbran 50.0% 3 / 6 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 75.0% 33 / 44 CC 6 SCAR 11.1
CC
6
Cov
82%
get_connection
5.0
new
3.1
BEGIN
1.0
CRAP 3.0
« HTTP2/IOSocketSSL.pm ↑ Summary HTTP2/RejectorRegistry.pm »
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
BranchTrueFalseTotal
unless ($ns->can("new")) 1 0 1
16 1 local $@;
17 1 ▶ Carp::croak $@ if !eval "require $ns";
Branch: 1 branch
BranchTrueFalseTotal
unless eval "require $ns" 0 1 1
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
BranchTrueFalseTotal
$port == 443 ? : 2 0 2
Condition40%2/5
$self->{"pool"}{$host}{$port or ""} ||= $self->{"conn_ns"}->new($host, %{$$self{"conn_opts"};}, $port == 443 ? () : ("port", $port))
l!l&&r!l&&!r
020
$port || ''
l!l
20
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))
ABresult
1X1
011
000
Truth table50%1/2
A
A= $port
Aresult
11
00
32 ($port == Net::HTTP2::Constants::HTTPS_PORT ? () : (port => $port)),
33 );
34 }
35  
36 1 1;
« HTTP2/IOSocketSSL.pm ↑ Summary HTTP2/RejectorRegistry.pm »