line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Pokemon::NamedAPIResource; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
32
|
use utf8; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
36
|
|
4
|
5
|
|
|
5
|
|
154
|
use strictures 2; |
|
5
|
|
|
|
|
33
|
|
|
5
|
|
|
|
|
170
|
|
5
|
5
|
|
|
5
|
|
878
|
use namespace::clean; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
33
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
884
|
use Moo; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
96
|
|
8
|
5
|
|
|
5
|
|
1346
|
use Types::Standard qw(HashRef InstanceOf); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
89
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has api => ( |
13
|
|
|
|
|
|
|
isa => InstanceOf['WebService::Pokemon'], |
14
|
|
|
|
|
|
|
is => 'rw', |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has response => ( |
18
|
|
|
|
|
|
|
isa => HashRef, |
19
|
|
|
|
|
|
|
is => 'rw', |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub BUILD { |
23
|
0
|
|
|
0
|
0
|
|
my ($self, $args) = @_; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
foreach my $arg (keys %{$args}) { |
|
0
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
$self->$arg($args->{$arg}) if (defined $args->{$arg}); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
foreach my $arg (keys %{$self->response}) { |
|
0
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
$self->meta->add_attribute( |
31
|
|
|
|
|
|
|
$arg => (is => 'rw', lazy => 1, builder => 1) |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $value = $self->response->{$arg}; |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
if (ref $value eq 'HASH') { |
37
|
0
|
|
|
|
|
|
$value = WebService::Pokemon::NamedAPIResource->new( |
38
|
|
|
|
|
|
|
api => $self->api, |
39
|
|
|
|
|
|
|
response => $value |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
if (ref $value eq 'ARRAY') { |
44
|
0
|
|
|
|
|
|
my $list; |
45
|
0
|
|
|
|
|
|
foreach my $v (@{$value}) { |
|
0
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
push @{$list}, |
|
0
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
WebService::Pokemon::NamedAPIResource->new( |
48
|
|
|
|
|
|
|
api => $self->api, |
49
|
|
|
|
|
|
|
response => $v |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
$value = $list; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
$self->$arg($value); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return $self; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|