EveCentral.pm

filter: Statementstmt 98.2% 55 / 56 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 95.2% 20 / 21 Podpod 100% 6 / 6 totaltotal 96.4% 82 / 85 CC 2 SCAR 1.3
CC
2
Cov
97%
_do_http_request
2.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.1
« EveCentral/Request.pm ↑ Summary EveCentral/HTTPRequest.pm »
1 package Games::EveOnline::EveCentral;
2 {
3 9 $Games::EveOnline::EveCentral::VERSION = '0.001';
4 }
5  
6 9 ▶use Moo 1.003001;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 9 ▶use MooX::Types::MooseLike 0.25;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 9 ▶use MooX::StrictConstructor 0.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 9 ▶use Sub::Quote 1.003001;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # ABSTRACT: A Perl library client for the EVE Central API.
12  
13  
14 9 ▶use 5.012;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 9 ▶use LWP::UserAgent::Determined 1.06;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 9 ▶use Try::Tiny 0.18;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 9 ▶use XML::LibXML 2.0108;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 9 ▶use JSON 2.90;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21  
22 9 has 'ua' => (
23 is => 'lazy',
24 isa => quote_sub(q{
25 die 'Not a LWP::UserAgent::Determined'
26 unless UNIVERSAL::isa($_[0], 'LWP::UserAgent::Determined');
27 })
28 );
29  
30 9 has 'libxml' => (
31 is => 'lazy',
32 isa => quote_sub(q{
33 die 'Not a XML::LibXML'
34 unless UNIVERSAL::isa($_[0], 'XML::LibXML');
35 })
36 );
37  
38 9 has 'jsonparser' => (
39 is => 'lazy',
40 isa => quote_sub(q{
41 die 'Not a JSON'
42 unless UNIVERSAL::isa($_[0], 'JSON');
43 })
44 );
45  
46  
47  
48 1 ▶sub marketstat {
Subroutine marketstat: called CC=1 SCAR=0.0
Pod documented
49 1 my ($self, $request) = @_;
50  
51 1 return $self->_do_http_request($request);
52 }
53  
54  
55 1 ▶sub quicklook {
Subroutine quicklook: called CC=1 SCAR=0.0
Pod documented
56 1 my ($self, $request) = @_;
57  
58 1 return $self->_do_http_request($request);
59 }
60  
61  
62 1 ▶sub quicklookpath {
Subroutine quicklookpath: called CC=1 SCAR=0.0
Pod documented
63 1 my ($self, $request) = @_;
64  
65 1 return $self->_do_http_request($request);
66 }
67  
68  
69 1 ▶sub history {
Subroutine history: called CC=1 SCAR=0.0
Pod documented
70 1 my ($self, $request) = @_;
71  
72 1 return $self->_do_http_request($request);
73 }
74  
75  
76 1 ▶sub evemon {
Subroutine evemon: called CC=1 SCAR=0.0
Pod documented
77 1 my ($self, $request) = @_;
78  
79 1 return $self->_do_http_request($request);
80 }
81  
82  
83 1 ▶sub route {
Subroutine route: called CC=1 SCAR=0.0
Pod documented
84 1 my ($self, $request) = @_;
85  
86 1 return $self->_do_http_request($request);
87 }
88  
89  
90 6 ▶sub _do_http_request {
Subroutine _do_http_request: called CC=2 SCAR=7.1
91 6 my ($self, $request) = @_;
92  
93 6 my $response;
94 6 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
95 6 $response = $self->ua->get($request);
96 }
97 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
98 0 print STDERR "HTTP request failed: $_";
99 6 };
100 6 ▶ return undef unless $response->is_success;
Branch: 1 branch
BranchTrueFalseTotal
unless $response->is_success 0 6 6
101  
102 6 return $response->decoded_content;
103 }
104  
105 1 ▶sub _build_ua {
Subroutine _build_ua: called CC=1 SCAR=0.0
106 1 my $ua = LWP::UserAgent::Determined->new;
107 1 $ua->env_proxy;
108  
109 1 return $ua;
110 }
111  
112 5 ▶sub _build_libxml {
Subroutine _build_libxml: called CC=1 SCAR=0.0
113 5 return XML::LibXML->new;
114 }
115  
116 2 ▶sub _build_jsonparser {
Subroutine _build_jsonparser: called CC=1 SCAR=0.0
117 2 return JSON->new->utf8;
118 }
119  
120  
121 9 1; # End of Games::EveOnline::EveCentral
122  
123 __END__
« EveCentral/Request.pm ↑ Summary EveCentral/HTTPRequest.pm »