1package Furl::ConnectionCache; 2use strict; 3use warnings; 4use utf8; 5 6sub new { bless [''], shift } 7 8sub steal { 9 my ($self, $host, $port) = @_; 10 if ($self->[0] eq "$host:$port") { 11 my $sock = $self->[1]; 12 @{$self} = (''); 13 return $sock; 14 } else { 15 return undef; 16 } 17} 18 19sub push { 20 my ($self, $host, $port, $sock) = @_; 21 $self->[0] = "$host:$port"; 22 $self->[1] = $sock; 23} 24 251; 26 27