line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::AnimeNewsNetwork::Encyclopedia; |
2
|
2
|
|
|
2
|
|
204014
|
use 5.10.0; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
84
|
|
3
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
54
|
|
4
|
2
|
|
|
2
|
|
18
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
47
|
|
5
|
2
|
|
|
2
|
|
1702
|
use Moo; |
|
2
|
|
|
|
|
40701
|
|
|
2
|
|
|
|
|
53
|
|
6
|
2
|
|
|
2
|
|
5801
|
use Data::Validator; |
|
2
|
|
|
|
|
66536
|
|
|
2
|
|
|
|
|
78
|
|
7
|
2
|
|
|
2
|
|
919
|
use URI; |
|
2
|
|
|
|
|
4203
|
|
|
2
|
|
|
|
|
52
|
|
8
|
2
|
|
|
2
|
|
1594
|
use LWP::Simple; |
|
2
|
|
|
|
|
102658
|
|
|
2
|
|
|
|
|
22
|
|
9
|
2
|
|
|
2
|
|
3515
|
use XML::Simple; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = "0.02"; |
12
|
|
|
|
|
|
|
our $URL = 'http://cdn.animenewsnetwork.com/encyclopedia'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has url => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
default => $URL, |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub get_reports { |
20
|
|
|
|
|
|
|
state $rule = Data::Validator->new( |
21
|
|
|
|
|
|
|
id => 'Int', |
22
|
|
|
|
|
|
|
type => 'Str', |
23
|
|
|
|
|
|
|
nskip => { isa => 'Int', optional => 1 }, |
24
|
|
|
|
|
|
|
nlist => { isa => 'Int', optional => 1 }, |
25
|
|
|
|
|
|
|
name => { isa => 'Str', optional => 1 }, |
26
|
|
|
|
|
|
|
)->with('Method'); |
27
|
|
|
|
|
|
|
my ($self, $args) = $rule->validate(@_); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $content = $self->_get("/reports.xml", $args); |
30
|
|
|
|
|
|
|
return XMLin($content); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub get_details { |
34
|
|
|
|
|
|
|
state $rule = Data::Validator->new( |
35
|
|
|
|
|
|
|
anime => { isa => 'Int', xor => [qw/manga title/] }, |
36
|
|
|
|
|
|
|
manga => { isa => 'Int', xor => [qw/anime title/] }, |
37
|
|
|
|
|
|
|
title => { isa => 'Int', xor => [qw/anime manga/] }, |
38
|
|
|
|
|
|
|
)->with('Method'); |
39
|
|
|
|
|
|
|
my ($self, $args) = $rule->validate(@_); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $content = $self->_get("/api.xml", $args); |
42
|
|
|
|
|
|
|
return XMLin($content); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _get { |
46
|
|
|
|
|
|
|
my ($self, $path, $query) = @_; |
47
|
|
|
|
|
|
|
my $uri = URI->new($self->url . $path); |
48
|
|
|
|
|
|
|
$uri->query_form($query); |
49
|
|
|
|
|
|
|
return get($uri); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
__END__ |