| 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
| |||||||||||
| 37 | 1 | return $self->{parsed_xml}->{Time}; | |||||||||
| 38 | } | ||||||||||
| 39 | 0 | return; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 2 | 1; | |||||||||
| 43 | |||||||||||
| 44 | __END__ | ||||||||||