line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Async::SPORE::Definition; |
2
|
|
|
|
|
|
|
$Net::Async::SPORE::Definition::VERSION = '0.003'; |
3
|
1
|
|
|
1
|
|
17
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Net::Async::SPORE::Definition - holds information about a SPORE definition |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 0.003 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
No user-serviceable parts inside. See L instead. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
936
|
use JSON::MaybeXS; |
|
1
|
|
|
|
|
7770
|
|
|
1
|
|
|
|
|
282
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 new |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Instantiates this object. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
1
|
1
|
2
|
sub new { my $class = shift; bless { @_ }, $class } |
|
1
|
|
|
|
|
5
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _transport { |
31
|
0
|
|
|
0
|
|
|
my $self = shift; |
32
|
0
|
0
|
|
|
|
|
return $self->{transport} if $self->{transport}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# If we didn't have a transport, set one up - |
35
|
|
|
|
|
|
|
# this is not the recommended usage and will |
36
|
|
|
|
|
|
|
# probably change in future. |
37
|
0
|
|
|
|
|
|
require IO::Async::Loop; |
38
|
0
|
|
|
|
|
|
require Net::Async::HTTP; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $loop = IO::Async::Loop->new; |
41
|
0
|
|
|
|
|
|
$loop->add( |
42
|
|
|
|
|
|
|
$self->{_transport} = Net::Async::HTTP->new |
43
|
|
|
|
|
|
|
); |
44
|
0
|
|
|
|
|
|
$self->{_transport} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _request { |
48
|
0
|
|
|
0
|
|
|
my ($self, $req) = @_; |
49
|
|
|
|
|
|
|
$self->_transport->do_request( |
50
|
|
|
|
|
|
|
request => $req |
51
|
|
|
|
|
|
|
)->transform( |
52
|
0
|
|
|
0
|
|
|
done => sub { decode_json(shift->content) } |
53
|
|
|
|
|
|
|
) |
54
|
0
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |