File Coverage

blib/lib/WebService/Rackspace/CloudFiles/ConnCache.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package WebService::Rackspace::CloudFiles::ConnCache;
2 5     5   87793 use Moo;
  5         7946  
  5         28  
3 5     5   2638 use Types::Standard qw(Int);
  5         81222  
  5         50  
4              
5             extends 'LWP::ConnCache';
6            
7             has 'max_keep_alive_requests', is => 'rw', isa => Int;
8              
9             around 'deposit' => sub {
10             my ($coderef, $self, $type, $key, $conn) = @_;
11             my $max_keep_alive_requests = $self->max_keep_alive_requests;
12            
13             my $keep_alive_requests = ${*$conn}{'myhttp_response_count'};
14             if ($keep_alive_requests < $max_keep_alive_requests) {
15             $self->$coderef($type, $key, $conn);
16             }
17             };
18            
19             1;
20            
21             __END__
22              
23             =head1 NAME
24            
25             WebService::Rackspace::CloudFiles::ConnCache is a subclass of LWP::ConnCache,
26             and is very similar to LWP::ConnCache::MaxKeepAliveRequests except that it uses
27             Moo instead of Moose.
28              
29             =head1 SYNOPSIS
30              
31             Same as LWP::ConnCache::MaxKeepAliveRequests.
32              
33             =head1 DESCRIPTION
34              
35             Same as LWP::ConnCache::MaxKeepAliveRequests.
36              
37             =head1 ADDITIONAL ATTRIBUTES
38              
39             =head2 max_keep_alive_requests
40              
41             Should be specied in the constructor. Read-only integer.
42              
43             =head1 METHODS MODIFIED
44              
45             =head2 deposit
46              
47             Same functionality as LWP::ConnCache::MaxKeepAliveRequests.
48              
49             =head1 AUTHOR
50            
51             Dondi Michael Stroma <dstroma@gmail.com>.
52              
53             Based on LWP::ConnCache::MaxKeepAliveRequests by Leon Brocard.
54            
55             =head1 COPYRIGHT
56            
57             Copyright (C) 2017, Dondi Michael Stroma.
58            
59             =head1 LICENSE
60            
61             This module is free software; you can redistribute it or modify it
62             under the same terms as Perl itself.