File Coverage

blib/lib/Furl/ConnectionCache.pm
Criterion Covered Total %
statement 20 20 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 0 3 0.0
total 28 31 90.3


line stmt bran cond sub pod time code
1             package Furl::ConnectionCache;
2 47     47   331 use strict;
  47         121  
  47         1959  
3 47     47   241 use warnings;
  47         82  
  47         2411  
4 47     47   19829 use utf8;
  47         11223  
  47         323  
5              
6 33     33 0 10792 sub new { bless [''], shift }
7              
8             sub steal {
9 58     58 0 377 my ($self, $host, $port) = @_;
10 58 100       429 if ($self->[0] eq "$host:$port") {
11 26         190 my $sock = $self->[1];
12 26         53 @{$self} = ('');
  26         280  
13 26         130 return $sock;
14             } else {
15 32         177 return undef;
16             }
17             }
18              
19             sub push {
20 41     41 0 153 my ($self, $host, $port, $sock) = @_;
21 41         193 $self->[0] = "$host:$port";
22 41         213 $self->[1] = $sock;
23             }
24              
25             1;
26