OpenGbg/Service/Getter.pm

filter: Statementstmt 65.3% 17 / 26 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 62.8% 22 / 35 CC 2 SCAR 8.9
CC
2
Cov
61%
getter
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.4
« OpenGbg/Service/StyrOchStall/Station.pm ↑ Summary OpenGbg/Service/AirQuality/GetLatestMeasurement.pm »
1 10 ▶use 5.10.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package OpenGbg::Service::Getter;
6  
7 10 our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY
8 10 our $VERSION = '0.1404';
9  
10 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 10 ▶use OpenGbg::Exceptions;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 0 ▶sub getter {
Subroutine getter: not called CC=2 SCAR=17.9
Pod undocumented
14 0 my $self = shift;
15 0 my $service_url = shift;
16 0 my $service_name = shift;
17  
18 0 $service_url = sprintf $service_url, $self->handler->key;
19 0 my $url = $self->handler->base . $self->service_base . $service_url.'format=xml';
20  
21 0 my $response = $self->handler->get($url);
22  
23 0 ▶ if(!$response->{'success'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($response->{"success"}) 0 0 0
24 0 die bad_response_from_service service => join ('::', $self, $service_name), url => $response->{'url'}, status => $response->{'status'}, reason => $response->{'reason'};
25 }
26 0 return $response->{'content'};
27 }
28  
29 10 1;
30  
31 __END__
« OpenGbg/Service/StyrOchStall/Station.pm ↑ Summary OpenGbg/Service/AirQuality/GetLatestMeasurement.pm »