| 1 | package WWW::NOS::Open v1.0.3; # -*- cperl; cperl-indent-level: 4 -*- | ||||||||||||||||||||||||||||||||||||||
| 2 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 3 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use 5.014000; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||
| 8 | 5 | ▶ | use Date::Calc qw(Add_Delta_Days Date_to_Days Delta_Days Today); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use Date::Format; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 10 | 5 | ▶ | use HTTP::Headers; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 11 | 5 | ▶ | use HTTP::Request; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 12 | use HTTP::Status | ||||||||||||||||||||||||||||||||||||||
| 13 | 5 | ▶ | qw(HTTP_OK HTTP_BAD_REQUEST HTTP_UNAUTHORIZED HTTP_FORBIDDEN HTTP_INTERNAL_SERVER_ERROR); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 14 | 5 | ▶ | use JSON; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 15 | 5 | ▶ | use LWP::UserAgent; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 16 | 5 | ▶ | use Log::Log4perl qw(:easy get_logger); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 17 | 5 | ▶ | use Moose qw/around has with/; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 18 | 5 | ▶ | use Moose::Util::TypeConstraints qw/enum/; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 19 | 5 | ▶ | use URI::Escape qw(uri_escape); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 20 | 5 | ▶ | use URI; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 21 | 5 | ▶ | use XML::Simple; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||
| 23 | 5 | ▶ | use namespace::autoclean '-also' => qr/^__/sxm; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||
| 25 | 5 | ▶ | use WWW::NOS::Open::Article; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 26 | 5 | ▶ | use WWW::NOS::Open::AudioFragment; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 27 | 5 | ▶ | use WWW::NOS::Open::Broadcast; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 28 | 5 | ▶ | use WWW::NOS::Open::DayGuide; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 29 | 5 | ▶ | use WWW::NOS::Open::Document; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 30 | 5 | ▶ | use WWW::NOS::Open::Exceptions; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 31 | 5 | ▶ | use WWW::NOS::Open::Result; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 32 | 5 | ▶ | use WWW::NOS::Open::TypeDef; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 33 | 5 | ▶ | use WWW::NOS::Open::Version; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 34 | 5 | ▶ | use WWW::NOS::Open::Video; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||
| 36 | 5 | ▶ | use Readonly; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 37 | 5 | ▶ | Readonly::Scalar my $SERVER => $ENV{'NOSOPEN_SERVER'} || q{http://open.nos.nl}; | ||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{'NOSOPEN_SERVER'} || 'http://open.nos.nl'
MC/DC0%0/1
$ENV{'NOSOPEN_SERVER'} || 'http://open.nos.nl'
$ENV{'NOSOPEN_SERVER'}
Truth table50%1/2
A
A= $ENV{'NOSOPEN_SERVER'}
| |||||||||||||||||||||||||||||||||||||||
| 38 | 5 | Readonly::Scalar my $TIMEOUT => 15; | |||||||||||||||||||||||||||||||||||||
| 39 | 5 | Readonly::Scalar my $AGENT => q{WWW::NOS::Open/} . $WWW::NOS::Open::VERSION; | |||||||||||||||||||||||||||||||||||||
| 40 | 5 | Readonly::Scalar my $DATE_FORMAT => q{%04u-%02u-%02u}; | |||||||||||||||||||||||||||||||||||||
| 41 | 5 | Readonly::Scalar my $DEFAULT_START => -1; # Yesterday | |||||||||||||||||||||||||||||||||||||
| 42 | 5 | Readonly::Scalar my $DEFAULT_END => 1; # Tomorrow | |||||||||||||||||||||||||||||||||||||
| 43 | 5 | Readonly::Scalar my $MAX_RANGE => 14; # Two weeks | |||||||||||||||||||||||||||||||||||||
| 44 | 5 | Readonly::Scalar my $GET => q{GET}; | |||||||||||||||||||||||||||||||||||||
| 45 | 5 | Readonly::Scalar my $DEFAULT_API_KEY => q{TEST}; | |||||||||||||||||||||||||||||||||||||
| 46 | 5 | Readonly::Scalar my $DEFAULT_OUTPUT => q{xml}; | |||||||||||||||||||||||||||||||||||||
| 47 | 5 | Readonly::Scalar my $DEFAULT_CATEGORY => q{nieuws}; | |||||||||||||||||||||||||||||||||||||
| 48 | 5 | Readonly::Scalar my $DASH => q{-}; | |||||||||||||||||||||||||||||||||||||
| 49 | 5 | Readonly::Scalar my $DOUBLE_COLON => q{::}; | |||||||||||||||||||||||||||||||||||||
| 50 | 5 | Readonly::Scalar my $FRAGMENT => q{Fragment}; | |||||||||||||||||||||||||||||||||||||
| 51 | 5 | Readonly::Scalar my $VERSION_PATH => q{%s/v1/index/version/key/%s/output/%s/}; | |||||||||||||||||||||||||||||||||||||
| 52 | 5 | Readonly::Scalar my $LATEST_PATH => | |||||||||||||||||||||||||||||||||||||
| 53 | q{%s/v1/latest/%s/key/%s/output/%s/category/%s/}; | ||||||||||||||||||||||||||||||||||||||
| 54 | 5 | Readonly::Scalar my $SEARCH_PATH => q{%s/v1/search/query/key/%s/output/%s/q/%s}; | |||||||||||||||||||||||||||||||||||||
| 55 | 5 | Readonly::Scalar my $GUIDE_PATH => | |||||||||||||||||||||||||||||||||||||
| 56 | q{%s/v1/guide/%s/key/%s/output/%s/start/%s/end/%s/}; | ||||||||||||||||||||||||||||||||||||||
| 57 | 5 | Readonly::Scalar my $XML_DETECT => qr{^<}smx; | |||||||||||||||||||||||||||||||||||||
| 58 | 5 | Readonly::Scalar my $STRIP_PRIVATE => qr{^_}smx; | |||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||
| 60 | 5 | Readonly::Hash my %ERR => ( | |||||||||||||||||||||||||||||||||||||
| 61 | 'INTERNAL_SERVER' => q{Internal server error or no response recieved}, | ||||||||||||||||||||||||||||||||||||||
| 62 | 'UNPARSABLE' => q{Could not parse data}, | ||||||||||||||||||||||||||||||||||||||
| 63 | 'EXCEEDED_RANGE' => qq{Date range exceeds maximum of $MAX_RANGE days}, | ||||||||||||||||||||||||||||||||||||||
| 64 | ); | ||||||||||||||||||||||||||||||||||||||
| 65 | 5 | Readonly::Hash my %LOG => ( | |||||||||||||||||||||||||||||||||||||
| 66 | 'REQUESTING' => q{Requesting %s}, | ||||||||||||||||||||||||||||||||||||||
| 67 | 'RESPONSE_CODE' => q{Response code %d}, | ||||||||||||||||||||||||||||||||||||||
| 68 | ); | ||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||
| 70 | 5 | Log::Log4perl::easy_init($ERROR); | |||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||
| 72 | 5 | my $log = Log::Log4perl->get_logger(__PACKAGE__); | |||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||
| 74 | has '_ua' => ( | ||||||||||||||||||||||||||||||||||||||
| 75 | 'is' => 'ro', | ||||||||||||||||||||||||||||||||||||||
| 76 | 'isa' => 'LWP::UserAgent', | ||||||||||||||||||||||||||||||||||||||
| 77 | 'default' => sub { | ||||||||||||||||||||||||||||||||||||||
| 78 | 5 | ▶ | LWP::UserAgent->new( | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 79 | 'timeout' => $TIMEOUT, | ||||||||||||||||||||||||||||||||||||||
| 80 | 'agent' => $AGENT, | ||||||||||||||||||||||||||||||||||||||
| 81 | ); | ||||||||||||||||||||||||||||||||||||||
| 82 | }, | ||||||||||||||||||||||||||||||||||||||
| 83 | 5 | ); | |||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||
| 85 | 5 | has '_version' => ( | |||||||||||||||||||||||||||||||||||||
| 86 | 'is' => 'ro', | ||||||||||||||||||||||||||||||||||||||
| 87 | 'isa' => 'WWW::NOS::Open::Version', | ||||||||||||||||||||||||||||||||||||||
| 88 | ); | ||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||
| 90 | sub get_version { | ||||||||||||||||||||||||||||||||||||||
| 91 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
get_version: called CC=1 SCAR=0.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 92 | 3 | my $url = sprintf $VERSION_PATH, $SERVER, | |||||||||||||||||||||||||||||||||||||
| 93 | URI::Escape::uri_escape( $self->get_api_key ), | ||||||||||||||||||||||||||||||||||||||
| 94 | URI::Escape::uri_escape( $self->_get_default_output ); | ||||||||||||||||||||||||||||||||||||||
| 95 | 3 | my $response = $self->_do_request($url); | |||||||||||||||||||||||||||||||||||||
| 96 | 0 | my $version = $self->_parse_version( $response->decoded_content ); | |||||||||||||||||||||||||||||||||||||
| 97 | 0 | return $version; | |||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||
| 100 | sub _parse_version { | ||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | my ( $self, $body ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_version: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my ( $version, $build ); | |||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | if ( $body =~ /$XML_DETECT/gsmx ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my $xml = XML::Simple->new( 'ForceArray' => 1 )->XMLin($body); | |||||||||||||||||||||||||||||||||||||
| 105 | 0 | $version = $xml->{'item'}[0]->{'version'}[0]; | |||||||||||||||||||||||||||||||||||||
| 106 | 0 | $build = $xml->{'item'}[0]->{'build'}[0]; | |||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||
| 108 | else { | ||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $log->fatal( $ERR{'UNPARSABLE'} ); | |||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||
| 111 | 0 | return WWW::NOS::Open::Version->new( $version, $build ); | |||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||
| 114 | 5 | has '_default_output' => ( | |||||||||||||||||||||||||||||||||||||
| 115 | 'is' => 'ro', | ||||||||||||||||||||||||||||||||||||||
| 116 | 'isa' => 'Str', | ||||||||||||||||||||||||||||||||||||||
| 117 | 'default' => $DEFAULT_OUTPUT, | ||||||||||||||||||||||||||||||||||||||
| 118 | 'reader' => '_get_default_output', | ||||||||||||||||||||||||||||||||||||||
| 119 | 'init_arg' => 'default_output', | ||||||||||||||||||||||||||||||||||||||
| 120 | ); | ||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||
| 122 | 5 | has '_api_key' => ( | |||||||||||||||||||||||||||||||||||||
| 123 | 'is' => 'rw', | ||||||||||||||||||||||||||||||||||||||
| 124 | 'isa' => 'Str', | ||||||||||||||||||||||||||||||||||||||
| 125 | 'default' => $DEFAULT_API_KEY, | ||||||||||||||||||||||||||||||||||||||
| 126 | 'reader' => 'get_api_key', | ||||||||||||||||||||||||||||||||||||||
| 127 | 'writer' => 'set_api_key', | ||||||||||||||||||||||||||||||||||||||
| 128 | 'init_arg' => 'api_key', | ||||||||||||||||||||||||||||||||||||||
| 129 | ); | ||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||
| 131 | sub _get_latest_resources { | ||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | my ( $self, $type, $category ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_latest_resources: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | ( defined $category ) || ( $category = $DEFAULT_CATEGORY ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my $url = sprintf $LATEST_PATH, | |||||||||||||||||||||||||||||||||||||
| 135 | $SERVER, | ||||||||||||||||||||||||||||||||||||||
| 136 | URI::Escape::uri_escape($type), | ||||||||||||||||||||||||||||||||||||||
| 137 | URI::Escape::uri_escape( $self->get_api_key ), | ||||||||||||||||||||||||||||||||||||||
| 138 | URI::Escape::uri_escape( $self->_get_default_output ), | ||||||||||||||||||||||||||||||||||||||
| 139 | URI::Escape::uri_escape($category); | ||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my $response = $self->_do_request($url); | |||||||||||||||||||||||||||||||||||||
| 141 | 0 | my @resources = | |||||||||||||||||||||||||||||||||||||
| 142 | $self->_parse_resources( $type, $response->decoded_content ); | ||||||||||||||||||||||||||||||||||||||
| 143 | 0 | return @resources; | |||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||
| 146 | sub get_latest_articles { | ||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | my ( $self, @param ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
get_latest_articles: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 148 | 0 | return $self->_get_latest_resources( q{article}, @param ); | |||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||
| 151 | sub __get_props { | ||||||||||||||||||||||||||||||||||||||
| 152 | my $meta = shift; | ||||||||||||||||||||||||||||||||||||||
| 153 | my @props = map { $_->name } $meta->get_all_attributes; | ||||||||||||||||||||||||||||||||||||||
| 154 | for (@props) { | ||||||||||||||||||||||||||||||||||||||
| 155 | s/$STRIP_PRIVATE//smx; | ||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||
| 157 | return @props; | ||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||
| 160 | sub _parse_resource { | ||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | my ( $self, $type, $hr_resource ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_resource: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||
| 162 | 0 | my %mapping = ( | |||||||||||||||||||||||||||||||||||||
| 163 | 'article' => __PACKAGE__ . $DOUBLE_COLON . ucfirst $type, | ||||||||||||||||||||||||||||||||||||||
| 164 | 'video' => __PACKAGE__ . $DOUBLE_COLON . ucfirst $type, | ||||||||||||||||||||||||||||||||||||||
| 165 | 'audio' => __PACKAGE__ . $DOUBLE_COLON . ucfirst $type . $FRAGMENT, | ||||||||||||||||||||||||||||||||||||||
| 166 | 'document' => __PACKAGE__ . $DOUBLE_COLON . ucfirst $type, | ||||||||||||||||||||||||||||||||||||||
| 167 | 'broadcast' => __PACKAGE__ . $DOUBLE_COLON . ucfirst $type, | ||||||||||||||||||||||||||||||||||||||
| 168 | ); | ||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||
| 170 | 0 | my @props = __get_props( ( $mapping{$type} )->meta ); | |||||||||||||||||||||||||||||||||||||
| 171 | 0 | my %param; | |||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | while ( my $prop = shift @props ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 173 | $param{$prop} = | ||||||||||||||||||||||||||||||||||||||
| 174 | ( q{HASH} eq ref $hr_resource->{$prop}[0] ) | ||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ? %{ $hr_resource->{$prop}[0] } | |||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | : $hr_resource->{$prop}[0]; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | $param{'keywords'} = $hr_resource->{'keywords'}->[0]->{'keyword'} || []; | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$hr_resource->{'keywords'}[0]{'keyword'} || []
MC/DC0%0/1
$hr_resource->{'keywords'}[0]{'keyword'} || []
$hr_resource->{'keywords'}[0]{'keyword'}
Truth table0%0/2
A
A= $hr_resource->{'keywords'}[0]{'keyword'}
| |||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | if ( my $resource = ( $mapping{$type} )->new(%param) ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 180 | 0 | return $resource; | |||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||
| 182 | 0 | return; | |||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||
| 185 | sub _parse_resources { | ||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | my ( $self, $type, $body ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_resources: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my @resources; | |||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | if ( $body =~ /$XML_DETECT/gsmx ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my $xml = XML::Simple->new( 'ForceArray' => 1 )->XMLin($body); | |||||||||||||||||||||||||||||||||||||
| 191 | 0 | my @xml_resources = @{ $xml->{$type} }; | |||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | while ( my $resource = shift @xml_resources ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 193 | 0 | push @resources, $self->_parse_resource( $type, $resource ); | |||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||
| 195 | 0 | return @resources; | |||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||
| 197 | else { | ||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $log->fatal( $ERR{'UNPARSABLE'} ); | |||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||
| 200 | 0 | return (); | |||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||
| 203 | sub get_latest_videos { | ||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | my ( $self, @param ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
get_latest_videos: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 205 | 0 | return $self->_get_latest_resources( q{video}, @param ); | |||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||
| 208 | sub get_latest_audio_fragments { | ||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | my ( $self, @param ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
get_latest_audio_fragments: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 210 | 0 | return $self->_get_latest_resources( q{audio}, @param ); | |||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||
| 213 | sub _parse_result { | ||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | my ( $self, $body ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_result: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||
| 215 | 0 | my @documents; | |||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | if ( $body =~ /$XML_DETECT/gsmx ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 217 | 0 | my $xml = XML::Simple->new( 'ForceArray' => 1 )->XMLin($body); | |||||||||||||||||||||||||||||||||||||
| 218 | 0 | my @xml_documents = @{ $xml->{'documents'}->[0]->{'document'} }; | |||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | while ( my $hr_document = shift @xml_documents ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 220 | 0 | push @documents, | |||||||||||||||||||||||||||||||||||||
| 221 | $self->_parse_resource( q{document}, $hr_document ); | ||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||
| 223 | my $result = WWW::NOS::Open::Result->new( | ||||||||||||||||||||||||||||||||||||||
| 224 | 'documents' => [@documents], | ||||||||||||||||||||||||||||||||||||||
| 225 | 0 | 'related' => $xml->{'related'}->[0]->{'related'}, | |||||||||||||||||||||||||||||||||||||
| 226 | ); | ||||||||||||||||||||||||||||||||||||||
| 227 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||
| 229 | else { | ||||||||||||||||||||||||||||||||||||||
| 230 | 0 | $log->fatal( $ERR{'UNPARSABLE'} ); | |||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||
| 232 | 0 | return (); | |||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||
| 235 | sub search { | ||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | my ( $self, $query ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
search: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my $url = sprintf $SEARCH_PATH, | |||||||||||||||||||||||||||||||||||||
| 238 | $SERVER, | ||||||||||||||||||||||||||||||||||||||
| 239 | URI::Escape::uri_escape( $self->get_api_key ), | ||||||||||||||||||||||||||||||||||||||
| 240 | URI::Escape::uri_escape( $self->_get_default_output ), | ||||||||||||||||||||||||||||||||||||||
| 241 | URI::Escape::uri_escape($query); | ||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my $response = $self->_do_request($url); | |||||||||||||||||||||||||||||||||||||
| 243 | 0 | my $result = $self->_parse_result( $response->decoded_content ); | |||||||||||||||||||||||||||||||||||||
| 244 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||
| 247 | sub __get_date { | ||||||||||||||||||||||||||||||||||||||
| 248 | 4 | ▶ | my ( $start_day, $end_day ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__get_date: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 249 | 4 | my $today = Date_to_Days(Today); | |||||||||||||||||||||||||||||||||||||
| 250 | return ( | ||||||||||||||||||||||||||||||||||||||
| 251 | ( | ||||||||||||||||||||||||||||||||||||||
| 252 | 4 | sprintf $DATE_FORMAT, | |||||||||||||||||||||||||||||||||||||
| 253 | Add_Delta_Days( 1, 1, 1, $today + $start_day - 1 ), | ||||||||||||||||||||||||||||||||||||||
| 254 | ), | ||||||||||||||||||||||||||||||||||||||
| 255 | ( | ||||||||||||||||||||||||||||||||||||||
| 256 | sprintf $DATE_FORMAT, | ||||||||||||||||||||||||||||||||||||||
| 257 | Add_Delta_Days( 1, 1, 1, $today + $end_day - 1 ), | ||||||||||||||||||||||||||||||||||||||
| 258 | ), | ||||||||||||||||||||||||||||||||||||||
| 259 | ); | ||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||
| 262 | sub _parse_dayguide { | ||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | my ( $self, $hr_dayguide ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_dayguide: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||
| 265 | 0 | my @props = __get_props( WWW::NOS::Open::DayGuide->meta ); | |||||||||||||||||||||||||||||||||||||
| 266 | 0 | my %param; | |||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | while ( my $prop = shift @props ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 268 | $param{$prop} = | ||||||||||||||||||||||||||||||||||||||
| 269 | ( q{ARRAY} eq ref $hr_dayguide->{$prop} ) | ||||||||||||||||||||||||||||||||||||||
| 270 | ? ( | ||||||||||||||||||||||||||||||||||||||
| 271 | ( q{HASH} eq ref $hr_dayguide->{$prop}[0] ) | ||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ? %{ $hr_dayguide->{$prop}[0] } | |||||||||||||||||||||||||||||||||||||
| 273 | : $hr_dayguide->{$prop}[0] | ||||||||||||||||||||||||||||||||||||||
| 274 | ) | ||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | : $hr_dayguide->{$prop}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||
| 277 | 0 | $param{'broadcasts'} = []; | |||||||||||||||||||||||||||||||||||||
| 278 | 0 | my @broadcasts = $hr_dayguide->{'item'}; | |||||||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | while ( my $ar_broadcast = shift @broadcasts ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 280 | 0 | push @{ $param{'broadcasts'} }, | |||||||||||||||||||||||||||||||||||||
| 281 | $self->_parse_resource( q{broadcast}, $ar_broadcast->[0] ); | ||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | if ( my $dayguide = WWW::NOS::Open::DayGuide->new(%param) ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 284 | 0 | return $dayguide; | |||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||
| 286 | 0 | return; | |||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||
| 289 | sub _parse_guide { | ||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | my ( $self, $body ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_guide: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||
| 291 | 0 | my @dayguides; | |||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | if ( $body =~ /$XML_DETECT/gsmx ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 293 | 0 | my $xml = XML::Simple->new( 'ForceArray' => 1 )->XMLin($body); | |||||||||||||||||||||||||||||||||||||
| 294 | 0 | my @xml_dayguides = @{ $xml->{'dayguide'} }; | |||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | while ( my $hr_dayguide = shift @xml_dayguides ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 296 | 0 | push @dayguides, $self->_parse_dayguide($hr_dayguide); | |||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||
| 298 | 0 | return @dayguides; | |||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||
| 300 | else { | ||||||||||||||||||||||||||||||||||||||
| 301 | 0 | $log->fatal( $ERR{'UNPARSABLE'} ); | |||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||
| 303 | 0 | return (); | |||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||
| 306 | sub _get_broadcasts { | ||||||||||||||||||||||||||||||||||||||
| 307 | 4 | ▶ | my ( $self, $type, $start, $end, $channel ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_broadcasts: called CC=6 SCAR=18.4
| |||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||
| 309 | 4 | my ( $default_start, $default_end ) = | |||||||||||||||||||||||||||||||||||||
| 310 | __get_date( $DEFAULT_START, $DEFAULT_END ); | ||||||||||||||||||||||||||||||||||||||
| 311 | 4 | ▶ | ( defined $start ) || ( $start = $default_start ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 312 | 4 | ▶ | ( defined $end ) || ( $end = $default_end ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||
| 314 | 4 | foreach ( $start, $end ) { | |||||||||||||||||||||||||||||||||||||
| 315 | 8 | ▶ | ( q{DateTime} eq ref ) && ( $_ = $_->ymd ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||
| 317 | 4 | ▶ | if ( Delta_Days( split /$DASH/smx, qq{$start$DASH$end} ) > $MAX_RANGE ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 318 | ## no critic qw(RequireExplicitInclusion) | ||||||||||||||||||||||||||||||||||||||
| 319 | NOSOpenExceededRangeException->throw( | ||||||||||||||||||||||||||||||||||||||
| 320 | ## use critic | ||||||||||||||||||||||||||||||||||||||
| 321 | 2 | 'error' => $ERR{'EXCEEDED_RANGE'}, | |||||||||||||||||||||||||||||||||||||
| 322 | ); | ||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||
| 324 | 2 | my $url = sprintf $GUIDE_PATH, | |||||||||||||||||||||||||||||||||||||
| 325 | $SERVER, | ||||||||||||||||||||||||||||||||||||||
| 326 | URI::Escape::uri_escape($type), | ||||||||||||||||||||||||||||||||||||||
| 327 | URI::Escape::uri_escape( $self->get_api_key ), | ||||||||||||||||||||||||||||||||||||||
| 328 | URI::Escape::uri_escape( $self->_get_default_output ), | ||||||||||||||||||||||||||||||||||||||
| 329 | URI::Escape::uri_escape($start), | ||||||||||||||||||||||||||||||||||||||
| 330 | URI::Escape::uri_escape($end); | ||||||||||||||||||||||||||||||||||||||
| 331 | 2 | my $response = $self->_do_request($url); | |||||||||||||||||||||||||||||||||||||
| 332 | 0 | my @guide_days = $self->_parse_guide( $response->decoded_content ); | |||||||||||||||||||||||||||||||||||||
| 333 | 0 | return @guide_days; | |||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||
| 336 | sub get_tv_broadcasts { | ||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | my ( $self, @param ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
get_tv_broadcasts: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 338 | 0 | return $self->_get_broadcasts( q{tv}, @param ); | |||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||
| 341 | sub get_radio_broadcasts { | ||||||||||||||||||||||||||||||||||||||
| 342 | 4 | ▶ | my ( $self, @param ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
get_radio_broadcasts: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 343 | 4 | return $self->_get_broadcasts( q{radio}, @param ); | |||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||
| 346 | sub _do_request { | ||||||||||||||||||||||||||||||||||||||
| 347 | 5 | ▶ | my ( $self, $url ) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_do_request: called CC=8 SCAR=34.8
| |||||||||||||||||||||||||||||||||||||||
| 348 | 5 | my $request = HTTP::Request->new( | |||||||||||||||||||||||||||||||||||||
| 349 | $GET => $url, | ||||||||||||||||||||||||||||||||||||||
| 350 | HTTP::Headers->new(), | ||||||||||||||||||||||||||||||||||||||
| 351 | ); | ||||||||||||||||||||||||||||||||||||||
| 352 | 5 | $log->debug( sprintf $LOG{'REQUESTING'}, $url ); | |||||||||||||||||||||||||||||||||||||
| 353 | 5 | my $response = $self->_ua->request($request); | |||||||||||||||||||||||||||||||||||||
| 354 | 5 | $log->debug( sprintf $LOG{'RESPONSE_CODE'}, $response->code ); | |||||||||||||||||||||||||||||||||||||
| 355 | 5 | ▶ | if ( $response->code == HTTP_INTERNAL_SERVER_ERROR ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 356 | ## no critic qw(RequireExplicitInclusion) | ||||||||||||||||||||||||||||||||||||||
| 357 | NOSOpenInternalServerErrorException->throw( | ||||||||||||||||||||||||||||||||||||||
| 358 | ## use critic | ||||||||||||||||||||||||||||||||||||||
| 359 | 5 | 'error' => $ERR{'INTERNAL_SERVER'}, | |||||||||||||||||||||||||||||||||||||
| 360 | ); | ||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||
| 362 | elsif ( $response->code > HTTP_OK ) { | ||||||||||||||||||||||||||||||||||||||
| 363 | 0 | my $json = JSON->new; | |||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | if ( $response->code == HTTP_BAD_REQUEST ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||
| 365 | ## no critic qw(RequireExplicitInclusion) | ||||||||||||||||||||||||||||||||||||||
| 366 | 0 | NOSOpenBadRequestException->throw( | |||||||||||||||||||||||||||||||||||||
| 367 | ## use critic | ||||||||||||||||||||||||||||||||||||||
| 368 | 'error' => $json->decode( $response->decoded_content ), | ||||||||||||||||||||||||||||||||||||||
| 369 | ); | ||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||
| 371 | elsif ( $response->code == HTTP_UNAUTHORIZED ) { | ||||||||||||||||||||||||||||||||||||||
| 372 | ## no critic qw(RequireExplicitInclusion) | ||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | NOSOpenUnauthorizedException->throw( | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$response->decoded_content || $response->content
MC/DC0%0/2
$response->decoded_content || $response->content
$response->decoded_content
$response->content
Truth table0%0/3
A || B
A= $response->decoded_contentB= $response->content
| |||||||||||||||||||||||||||||||||||||||
| 374 | ## use critic | ||||||||||||||||||||||||||||||||||||||
| 375 | 'error' => $json->decode( | ||||||||||||||||||||||||||||||||||||||
| 376 | $response->decoded_content || $response->content, | ||||||||||||||||||||||||||||||||||||||
| 377 | ), | ||||||||||||||||||||||||||||||||||||||
| 378 | ); | ||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||
| 380 | elsif ( $response->code == HTTP_FORBIDDEN ) { | ||||||||||||||||||||||||||||||||||||||
| 381 | ## no critic qw(RequireExplicitInclusion) | ||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | NOSOpenForbiddenException->throw( | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$response->decoded_content || $response->content
MC/DC0%0/2
$response->decoded_content || $response->content
$response->decoded_content
$response->content
Truth table0%0/3
A || B
A= $response->decoded_contentB= $response->content
| |||||||||||||||||||||||||||||||||||||||
| 383 | ## use critic | ||||||||||||||||||||||||||||||||||||||
| 384 | 'error' => $json->decode( | ||||||||||||||||||||||||||||||||||||||
| 385 | $response->decoded_content || $response->content, | ||||||||||||||||||||||||||||||||||||||
| 386 | ), | ||||||||||||||||||||||||||||||||||||||
| 387 | ); | ||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||
| 390 | 0 | return $response; | |||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||
| 393 | around 'BUILDARGS' => sub { | ||||||||||||||||||||||||||||||||||||||
| 394 | 5 | ▶ | my $orig = shift; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.8
| |||||||||||||||||||||||||||||||||||||||
| 395 | 5 | my $class = shift; | |||||||||||||||||||||||||||||||||||||
| 396 | 5 | my ( $api_key, $default_output ) = @_; | |||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||
| 398 | 5 | ▶ | return $class->$orig( | ||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
$api_key || $DEFAULT_API_KEY
$default_output || $DEFAULT_OUTPUT
MC/DC0%0/2
$api_key || $DEFAULT_API_KEY
$api_key
$DEFAULT_API_KEY
MC/DC0%0/2
$default_output || $DEFAULT_OUTPUT
$default_output
$DEFAULT_OUTPUT
Truth table66%2/3
A || B
A= $api_keyB= $DEFAULT_API_KEY
Truth table33%1/3
A || B
A= $default_outputB= $DEFAULT_OUTPUT
| |||||||||||||||||||||||||||||||||||||||
| 399 | 'api_key' => $api_key || $DEFAULT_API_KEY, | ||||||||||||||||||||||||||||||||||||||
| 400 | 'default_output' => $default_output || $DEFAULT_OUTPUT, | ||||||||||||||||||||||||||||||||||||||
| 401 | ); | ||||||||||||||||||||||||||||||||||||||
| 402 | 5 | }; | |||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||
| 404 | 5 | with 'WWW::NOS::Open::Interface'; | |||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||
| 406 | 5 | ▶ | no Moose; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||
| 408 | 5 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||
| 410 | 5 | 1; | |||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||
| 412 | __END__ | ||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||
| 414 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||
| 416 | =for stopwords DateTime perl JSON Readonly URI PHP Ipenburg MERCHANTABILITY | ||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||
| 418 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||
| 420 | WWW::NOS::Open - Perl framework for the Open NOS REST API. | ||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||
| 422 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||
| 424 | This document describes WWW::NOS::Open version v1.0.3. | ||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||
| 426 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||
| 428 | use WWW::NOS::Open; | ||||||||||||||||||||||||||||||||||||||
| 429 | my $nos = WWW::NOS::Open->new($API_KEY); | ||||||||||||||||||||||||||||||||||||||
| 430 | @latest_articles = $nos->get_latest_articles('nieuws'); | ||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||
| 432 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||
| 434 | The L<Dutch public broadcasting foundation NOS|http:://www.nos.nl> provides a | ||||||||||||||||||||||||||||||||||||||
| 435 | REST API to their content. This module provides a wrapper around that API to | ||||||||||||||||||||||||||||||||||||||
| 436 | use data from the Open NOS platform with Perl. | ||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||
| 438 | =head1 SUBROUTINES/METHODS | ||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||
| 440 | =head2 C<new> | ||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||
| 442 | Create a new WWW::NOS::Open object. | ||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||
| 444 | =over | ||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||
| 446 | =item 1. The API key to use in the connection to the Open NOS service. You | ||||||||||||||||||||||||||||||||||||||
| 447 | need to L<register at Open NOS|http://open.nos.nl/registratie/> to get an API | ||||||||||||||||||||||||||||||||||||||
| 448 | key, and link your IP address to that account to do authorized requests. | ||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||
| 450 | =back | ||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||
| 452 | =head2 C<get_version> | ||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||
| 454 | Gets the version of the REST API as a | ||||||||||||||||||||||||||||||||||||||
| 455 | L<WWW::NOS::Open::Version|WWW::NOS::Open::Version> object. | ||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||
| 457 | =head2 C<get_latest_articles> | ||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||
| 459 | Returns the ten most recent articles as an array of | ||||||||||||||||||||||||||||||||||||||
| 460 | L<WWW::NOS::Open::Article|WWW::NOS::Open::Article> objects. | ||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||
| 462 | =over | ||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||
| 464 | =item 1. The optional category of the requested articles, C<nieuws> or | ||||||||||||||||||||||||||||||||||||||
| 465 | C<sport>. Defaults to the category C<nieuws>. | ||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||
| 467 | =back | ||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||
| 469 | =head2 C<get_latest_videos> | ||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||
| 471 | Returns the ten most recent videos as an array of | ||||||||||||||||||||||||||||||||||||||
| 472 | L<WWW::NOS::Open::Video|WWW::NOS::Open::Video> objects. | ||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||
| 474 | =over | ||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||
| 476 | =item 1. The optional category of the requested videos, C<nieuws> or C<sport>. | ||||||||||||||||||||||||||||||||||||||
| 477 | Defaults to the category C<nieuws>. | ||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||
| 479 | =back | ||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||
| 481 | =head2 C<get_latest_audio_fragments> | ||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||
| 483 | Returns the ten most recent audio fragments as an array of | ||||||||||||||||||||||||||||||||||||||
| 484 | L<WWW::NOS::Open::AudioFragment|WWW::NOS::Open::AudioFragment> objects. | ||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||
| 486 | =over | ||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||
| 488 | =item 1. The optional category of the requested audio fragments, C<nieuws> or | ||||||||||||||||||||||||||||||||||||||
| 489 | C<sport>. Defaults to the category C<nieuws>. | ||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||
| 491 | =back | ||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||
| 493 | =head2 C<search> | ||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||
| 495 | Search the search engine from L<NOS|http://www.nos.nl> for keywords. Returns | ||||||||||||||||||||||||||||||||||||||
| 496 | a L<WWW::NOS::Open::Results|WWW::NOS::Open::Results> object with a maximum of | ||||||||||||||||||||||||||||||||||||||
| 497 | 25 items. | ||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||
| 499 | =over | ||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||
| 501 | =item 1. The keyword or a combination of keywords, for example C<cricket>, | ||||||||||||||||||||||||||||||||||||||
| 502 | C<cricket AND engeland>, C<cricket OR curling>. | ||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||
| 504 | =back | ||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||
| 506 | =head2 C<get_tv_broadcasts> | ||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||
| 508 | Gets a collection of television broadcasts between two optional dates. Returns | ||||||||||||||||||||||||||||||||||||||
| 509 | an array of L<WWW::NOS::Open::DayGuide|WWW::NOS::Open::DayGuide> objects. The | ||||||||||||||||||||||||||||||||||||||
| 510 | period defaults to starting yesterday and ending tomorrow. The period has an | ||||||||||||||||||||||||||||||||||||||
| 511 | upper limit of 14 days. An C<NOSOpenExceededRangeException> is thrown when | ||||||||||||||||||||||||||||||||||||||
| 512 | this limit is exceeded. | ||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||
| 514 | =over | ||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||
| 516 | =item 1. Start date in the format C<YYYY-MM-DD> or as L<DateTime|DateTime> | ||||||||||||||||||||||||||||||||||||||
| 517 | object. | ||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||
| 519 | =item 2. End date in the format C<YYYY-MM-DD> or as L<DateTime|DateTime> | ||||||||||||||||||||||||||||||||||||||
| 520 | object. | ||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||
| 522 | =back | ||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||
| 524 | =head2 C<get_radio_broadcasts> | ||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||
| 526 | Gets a collection of radio broadcasts between two optional dates. Returns an | ||||||||||||||||||||||||||||||||||||||
| 527 | array of L<WWW::NOS::Open::DayGuide|WWW::NOS::Open::DayGuide> objects. The | ||||||||||||||||||||||||||||||||||||||
| 528 | period defaults to starting yesterday and ending tomorrow. The period has an | ||||||||||||||||||||||||||||||||||||||
| 529 | upper limit of 14 days. An C<NOSOpenExceededRangeException> is thrown when this | ||||||||||||||||||||||||||||||||||||||
| 530 | limit is exceeded. | ||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||
| 532 | =over | ||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||
| 534 | =item 1. Start date in the format C<YYYY-MM-DD> or as L<DateTime|DateTime> | ||||||||||||||||||||||||||||||||||||||
| 535 | object. | ||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||
| 537 | =item 2. End date in the format C<YYYY-MM-DD> or as L<DateTime|DateTime> | ||||||||||||||||||||||||||||||||||||||
| 538 | object. | ||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||
| 540 | =back | ||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||
| 542 | =head1 CONFIGURATION AND ENVIRONMENT | ||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||
| 544 | To use this module with the live content of Open NOS you need an API key which | ||||||||||||||||||||||||||||||||||||||
| 545 | can be obtained by registering at L<Open NOS|http://open.nos.nl/registratie/> | ||||||||||||||||||||||||||||||||||||||
| 546 | and then configure your account there with the IP range you'll be accessing | ||||||||||||||||||||||||||||||||||||||
| 547 | the service from. | ||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||
| 549 | This module can use the optional environment variable C<NOSOPEN_SERVER> to | ||||||||||||||||||||||||||||||||||||||
| 550 | specify a server URL that is not the default Open NOS live service at | ||||||||||||||||||||||||||||||||||||||
| 551 | L<http://open.nos.nl|http://open.nos.nl>. | ||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||
| 553 | The user agent identifier used in the request to the REST API is | ||||||||||||||||||||||||||||||||||||||
| 554 | C<WWW::NOS::Open/v1.0.3>. | ||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||
| 556 | =head1 DEPENDENCIES | ||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||
| 558 | =over | ||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||
| 560 | =item * perl 5.14 | ||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||
| 562 | =item * L<Date::Calc|Date::Calc> | ||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||
| 564 | =item * L<Date::Format|Date::Format> | ||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||
| 566 | =item * L<HTTP::Headers|HTTP::Headers> | ||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||
| 568 | =item * L<HTTP::Request|HTTP::Request> | ||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||
| 570 | =item * L<HTTP::Status|HTTP::Status> | ||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||
| 572 | =item * L<JSON|JSON> | ||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||
| 574 | =item * L<LWP::UserAgent|LWP::UserAgent> | ||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||
| 576 | =item * L<Log::Log4perl|Log::Log4perl> | ||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||
| 578 | =item * L<Moose|Moose> | ||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||
| 580 | =item * L<Moose::Util::TypeConstraints|Moose::Util::TypeConstraints> | ||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||
| 582 | =item * L<Readonly|Readonly> | ||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||
| 584 | =item * L<URI|URI>, L<URI::Escape|URI::Escape> | ||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||
| 586 | =item * L<WWW::NOS::Open::Article|WWW::NOS::Open::Article> | ||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||
| 588 | =item * L<WWW::NOS::Open::AudioFragment|WWW::NOS::Open::AudioFragment> | ||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||
| 590 | =item * L<WWW::NOS::Open::Broadcast|WWW::NOS::Open::Broadcast> | ||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||
| 592 | =item * L<WWW::NOS::Open::DayGuide|WWW::NOS::Open::DayGuide> | ||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||
| 594 | =item * L<WWW::NOS::Open::Document|WWW::NOS::Open::Document> | ||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||
| 596 | =item * L<WWW::NOS::Open::Exceptions|WWW::NOS::Open::Exceptions> | ||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||
| 598 | =item * L<WWW::NOS::Open::Result|WWW::NOS::Open::Result> | ||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||
| 600 | =item * L<WWW::NOS::Open::TypeDef|WWW::NOS::Open::TypeDef> | ||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||
| 602 | =item * L<WWW::NOS::Open::Version|WWW::NOS::Open::Version> | ||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||
| 604 | =item * L<WWW::NOS::Open::Video|WWW::NOS::Open::Video> | ||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||
| 606 | =item * L<XML::Simple|XML::Simple> | ||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||
| 608 | =item * L<namespace::autoclean|namespace::autoclean> | ||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||
| 610 | =back | ||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||
| 612 | =head1 INCOMPATIBILITIES | ||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||
| 614 | None. | ||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||
| 616 | =head1 DIAGNOSTICS | ||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||
| 618 | Exceptions in the form of an L<Exception::Class|Exception::Class> are thrown | ||||||||||||||||||||||||||||||||||||||
| 619 | when the Open NOS service reports an exception: | ||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||
| 621 | =head2 C<NOSOpenUnauthorizedException> | ||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||
| 623 | When a request was made without a valid API key, or from an IP address not | ||||||||||||||||||||||||||||||||||||||
| 624 | configured to be valid for that API key. | ||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||
| 626 | =head2 C<NOSOpenExceededRangeException> | ||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||
| 628 | When the time period for a guide request exceeds the supported range of 14 | ||||||||||||||||||||||||||||||||||||||
| 629 | days. | ||||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||||
| 631 | =head2 C<NOSOpenInternalServerErrorException> | ||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||
| 633 | When an internal server error has occurred in the Open NOS service. | ||||||||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||||||
| 635 | =head2 C<NOSOpenBadRequestException> | ||||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||||
| 637 | When the Open NOS service reports the request had bad syntax. | ||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||
| 639 | =head1 BUGS AND LIMITATIONS | ||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||
| 641 | Currently this module only uses the XML output of the Open NOS service and has | ||||||||||||||||||||||||||||||||||||||
| 642 | no option to use the JSON or serialized PHP formats. When the API matures the | ||||||||||||||||||||||||||||||||||||||
| 643 | other output options might be added and the content of the raw responses | ||||||||||||||||||||||||||||||||||||||
| 644 | exposed for further processing in an appropriate environment. | ||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||
| 646 | Please report any bugs or feature requests at | ||||||||||||||||||||||||||||||||||||||
| 647 | L<RT for rt.cpan.org|https://rt.cpan.org/Dist/Display.html?Queue=WWW-NOS-Open>. | ||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||
| 649 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||
| 651 | Roland van Ipenburg, E<lt>ipenburg@xs4all.nlE<gt> | ||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||
| 653 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||
| 655 | Copyright 2012 by Roland van Ipenburg | ||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||
| 657 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||
| 658 | it under the same terms as Perl itself, either Perl version 5.14.0 or, | ||||||||||||||||||||||||||||||||||||||
| 659 | at your option, any later version of Perl 5 you may have available. | ||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||
| 661 | =head1 DISCLAIMER OF WARRANTY | ||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||
| 663 | BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY | ||||||||||||||||||||||||||||||||||||||
| 664 | FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN | ||||||||||||||||||||||||||||||||||||||
| 665 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES | ||||||||||||||||||||||||||||||||||||||
| 666 | PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER | ||||||||||||||||||||||||||||||||||||||
| 667 | EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||||||||||||||||||||||||||||||||||||||
| 668 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE | ||||||||||||||||||||||||||||||||||||||
| 669 | ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH | ||||||||||||||||||||||||||||||||||||||
| 670 | YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL | ||||||||||||||||||||||||||||||||||||||
| 671 | NECESSARY SERVICING, REPAIR, OR CORRECTION. | ||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||
| 673 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | ||||||||||||||||||||||||||||||||||||||
| 674 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR | ||||||||||||||||||||||||||||||||||||||
| 675 | REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE | ||||||||||||||||||||||||||||||||||||||
| 676 | LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, | ||||||||||||||||||||||||||||||||||||||
| 677 | OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE | ||||||||||||||||||||||||||||||||||||||
| 678 | THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING | ||||||||||||||||||||||||||||||||||||||
| 679 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A | ||||||||||||||||||||||||||||||||||||||
| 680 | FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF | ||||||||||||||||||||||||||||||||||||||
| 681 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF | ||||||||||||||||||||||||||||||||||||||
| 682 | SUCH DAMAGES. | ||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||
| 684 | =cut | ||||||||||||||||||||||||||||||||||||||