Riak/Role/UserAgent.pm

filter: Statementstmt 97.1% 34 / 35 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 86.0% 43 / 50 CC 3 SCAR 4.4
CC
3
Cov
90%
connection_cache
2.5
__ANON__
2.0
BEGIN
1.0
CRAP 1.6
« Riak/Transport/PBC/Code.pm ↑ Summary Riak/Link.pm »
1 package Net::Riak::Role::UserAgent;
2 {
3 4 $Net::Riak::Role::UserAgent::VERSION = '0.1702';
4 }
5 {
6 4 $Net::Riak::Role::UserAgent::VERSION = '0.1600';
7 }
8  
9 # ABSTRACT: useragent for Net::Riak
10  
11 4 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use LWP::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 4 ▶use LWP::ConnCache;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 4 ▶use IO::Socket::SSL;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 4 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 4 our $CONN_CACHE;
18  
19 2 ▶sub connection_cache { $CONN_CACHE ||= LWP::ConnCache->new }
Subroutine connection_cache: called CC=2 SCAR=9.2
Pod undocumented
Condition33%1/3
$Net::Riak::Role::UserAgent::CONN_CACHE ||= "LWP::ConnCache"->new
l!l&&r!l&&!r
020
MC/DC0%0/2
$Net::Riak::Role::UserAgent::CONN_CACHE ||= "LWP::ConnCache"->new
$Net::Riak::Role::UserAgent::CONN_CACHE "LWP::ConnCache"->new
Truth table33%1/3
A ||= B
A= $Net::Riak::Role::UserAgent::CONN_CACHEB= "LWP::ConnCache"->new
ABresult
1X1
011
000
20  
21 4 has ua_timeout => (
22 is => 'rw',
23 isa => 'Int',
24 default => 120
25 );
26  
27 4 has ssl_opts => (
28 is => 'rw',
29 isa => 'HashRef'
30 );
31  
32 has useragent => (
33 is => 'rw',
34 isa => 'LWP::UserAgent',
35 lazy => 1,
36 2 ▶ default => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
37 2 my $self = shift;
38  
39 # The Links header Riak returns (esp. for buckets) can get really long,
40 # so here increase the MaxLineLength LWP will accept (default = 8192)
41 2 my %opts = @LWP::Protocol::http::EXTRA_SOCK_OPTS;
42 2 $opts{MaxLineLength} = 65_536;
43 2 @LWP::Protocol::http::EXTRA_SOCK_OPTS = %opts;
44 2 my $ua = undef;
45  
46 2 ▶ if ( !$self->ssl ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->ssl) { } 2 0 2
47 2 $ua = LWP::UserAgent->new(
48 timeout => $self->ua_timeout,
49 keep_alive => 1,
50 );
51 } else {
52 0 $ua = LWP::UserAgent->new(
53 timeout => $self->ua_timeout,
54 keep_alive => 1,
55 ssl_opts => $self->ssl_opts
56 );
57 }
58  
59 2 $ua->conn_cache(__PACKAGE__->connection_cache);
60  
61 2 $ua;
62 }
63 4 );
64  
65 4 1;
66  
67 __END__
« Riak/Transport/PBC/Code.pm ↑ Summary Riak/Link.pm »