File: ConnectionCache.pm

package info (click to toggle)
libfurl-perl 3.14-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 660 kB
  • sloc: perl: 2,188; makefile: 5; sh: 1
file content (26 lines) | stat: -rw-r--r-- 423 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package Furl::ConnectionCache;
use strict;
use warnings;
use utf8;

sub new { bless [''], shift }

sub steal {
    my ($self, $host, $port) = @_;
    if ($self->[0] eq "$host:$port") {
        my $sock = $self->[1];
        @{$self} = ('');
        return $sock;
    } else {
        return undef;
    }
}

sub push {
    my ($self, $host, $port, $sock) = @_;
    $self->[0] = "$host:$port";
    $self->[1] = $sock;
}

1;