TVDB/Servertime.pm

filter: Statementstmt 86.6% 26 / 30 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 100% 3 / 3 totaltotal 86.0% 37 / 43 CC 2 SCAR 3.1
CC
2
Cov
84%
get_servertime
2.1
fetch_servertime
2.0
BEGIN
1.0
CRAP 1.4
« TVDB/Episode.pm ↑ Summary TVDB/Actor.pm »
1 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package WebService::TVDB::Servertime;
5 {
6 2 $WebService::TVDB::Servertime::VERSION = '1.133200';
7 }
8  
9 # ABSTRACT: Gets and saves the TVDB servertime
10  
11 2 ▶use XML::Simple qw(:strict);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use LWP::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 2 ▶use constant SERVERTIME_URL => 'http://thetvdb.com/api/Updates.php?type=none';
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
17 1 my $class = shift;
18 1 my $args = shift;
19 1 my $self = {};
20  
21 1 bless( $self, $class );
22 1 return $self;
23 }
24  
25 0 ▶sub fetch_servertime {
Subroutine fetch_servertime: not called CC=1 SCAR=6.9
Pod documented
26 0 my ($self) = @_;
27  
28 0 my $xml = LWP::Simple::get(SERVERTIME_URL);
29 $self->{parsed_xml} =
30 0 XML::Simple::XMLin( $xml, ForceArray => 0, KeyAttr => [] );
31 }
32  
33 1 ▶sub get_servertime {
Subroutine get_servertime: called CC=2 SCAR=7.6
Pod documented
34 1 my ($self) = @_;
35  
36 1 ▶ if ( defined $self->{parsed_xml} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"parsed_xml"}) 1 0 1
37 1 return $self->{parsed_xml}->{Time};
38 }
39 0 return;
40 }
41  
42 2 1;
43  
44 __END__
« TVDB/Episode.pm ↑ Summary TVDB/Actor.pm »