line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Games::EveOnline::EveCentral; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Games::EveOnline::EveCentral::VERSION = '0.001'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
3839423
|
use Moo 1.003001; |
|
8
|
|
|
|
|
159281
|
|
|
8
|
|
|
|
|
64
|
|
7
|
8
|
|
|
8
|
|
58949
|
use MooX::Types::MooseLike 0.25; |
|
8
|
|
|
|
|
11909
|
|
|
8
|
|
|
|
|
396
|
|
8
|
8
|
|
|
8
|
|
6006
|
use MooX::StrictConstructor 0.006; |
|
8
|
|
|
|
|
96886
|
|
|
8
|
|
|
|
|
63
|
|
9
|
8
|
|
|
8
|
|
218354
|
use Sub::Quote 1.003001; |
|
8
|
|
|
|
|
293
|
|
|
8
|
|
|
|
|
690
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# ABSTRACT: A Perl library client for the EVE Central API. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
8
|
|
|
8
|
|
124
|
use 5.012; |
|
8
|
|
|
|
|
25
|
|
|
8
|
|
|
|
|
281
|
|
15
|
|
|
|
|
|
|
|
16
|
8
|
|
|
8
|
|
7866
|
use LWP::UserAgent::Determined 1.06; |
|
8
|
|
|
|
|
464657
|
|
|
8
|
|
|
|
|
317
|
|
17
|
8
|
|
|
8
|
|
2312
|
use Try::Tiny 0.18; |
|
8
|
|
|
|
|
2677
|
|
|
8
|
|
|
|
|
626
|
|
18
|
8
|
|
|
8
|
|
16607
|
use XML::LibXML 2.0108; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use JSON 2.90; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'ua' => ( |
23
|
|
|
|
|
|
|
is => 'lazy', |
24
|
|
|
|
|
|
|
isa => quote_sub(q{ |
25
|
|
|
|
|
|
|
die 'Not a LWP::UserAgent::Determined' |
26
|
|
|
|
|
|
|
unless UNIVERSAL::isa($_[0], 'LWP::UserAgent::Determined'); |
27
|
|
|
|
|
|
|
}) |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has 'libxml' => ( |
31
|
|
|
|
|
|
|
is => 'lazy', |
32
|
|
|
|
|
|
|
isa => quote_sub(q{ |
33
|
|
|
|
|
|
|
die 'Not a XML::LibXML' |
34
|
|
|
|
|
|
|
unless UNIVERSAL::isa($_[0], 'XML::LibXML'); |
35
|
|
|
|
|
|
|
}) |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has 'jsonparser' => ( |
39
|
|
|
|
|
|
|
is => 'lazy', |
40
|
|
|
|
|
|
|
isa => quote_sub(q{ |
41
|
|
|
|
|
|
|
die 'Not a JSON' |
42
|
|
|
|
|
|
|
unless UNIVERSAL::isa($_[0], 'JSON'); |
43
|
|
|
|
|
|
|
}) |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub marketstat { |
49
|
|
|
|
|
|
|
my ($self, $request) = @_; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
return $self->_do_http_request($request); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub quicklook { |
56
|
|
|
|
|
|
|
my ($self, $request) = @_; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
return $self->_do_http_request($request); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub quicklookpath { |
63
|
|
|
|
|
|
|
my ($self, $request) = @_; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
return $self->_do_http_request($request); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub history { |
70
|
|
|
|
|
|
|
my ($self, $request) = @_; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
return $self->_do_http_request($request); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub evemon { |
77
|
|
|
|
|
|
|
my ($self, $request) = @_; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
return $self->_do_http_request($request); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub route { |
84
|
|
|
|
|
|
|
my ($self, $request) = @_; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
return $self->_do_http_request($request); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub _do_http_request { |
91
|
|
|
|
|
|
|
my ($self, $request) = @_; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my $response; |
94
|
|
|
|
|
|
|
try { |
95
|
|
|
|
|
|
|
$response = $self->ua->get($request); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
catch { |
98
|
|
|
|
|
|
|
print STDERR "HTTP request failed: $_"; |
99
|
|
|
|
|
|
|
}; |
100
|
|
|
|
|
|
|
return undef unless $response->is_success; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
return $response->decoded_content; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub _build_ua { |
106
|
|
|
|
|
|
|
my $ua = LWP::UserAgent::Determined->new; |
107
|
|
|
|
|
|
|
$ua->env_proxy; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
return $ua; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub _build_libxml { |
113
|
|
|
|
|
|
|
return XML::LibXML->new; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub _build_jsonparser { |
117
|
|
|
|
|
|
|
return JSON->new->utf8; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; # End of Games::EveOnline::EveCentral |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
__END__ |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=pod |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 NAME |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Games::EveOnline::EveCentral - A Perl library client for the EVE Central API. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 VERSION |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
version 0.001 |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 SYNOPSIS |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
use Games::EveOnline::EveCentral; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
my $client = Games::EveOnline::EveCentral->new; |
140
|
|
|
|
|
|
|
# ... |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 DESCRIPTION |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This module provides a client library for the API made available by |
145
|
|
|
|
|
|
|
L<http://eve-central.com/>. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Full API documentation is available at |
148
|
|
|
|
|
|
|
L<http://dev.eve-central.com/evec-api/start>. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 METHODS |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 new |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
use Games::EveOnline::EveCentral; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
my $client = Games::EveOnline::EveCentral->new; |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head2 marketstat |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
my $xml = $client->marketstat( |
161
|
|
|
|
|
|
|
Games::EveOnline::EveCentral::Request::MarketStat->new( |
162
|
|
|
|
|
|
|
type_id => 34, # or [34, 35]. Mandatory. |
163
|
|
|
|
|
|
|
hours => 1, # defaults to 24 |
164
|
|
|
|
|
|
|
min_q => 10000, # defaults to 1 |
165
|
|
|
|
|
|
|
system => 30000142, |
166
|
|
|
|
|
|
|
regions => 10000002, # or [10000002, 10000003], |
167
|
|
|
|
|
|
|
)->request |
168
|
|
|
|
|
|
|
); |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 quicklook |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
my $xml = $client->quicklook( |
173
|
|
|
|
|
|
|
Games::EveOnline::EveCentral::Request::QuickLook->new( |
174
|
|
|
|
|
|
|
type_id => 34, # Mandatory. |
175
|
|
|
|
|
|
|
hours => 1, # defaults to 360 |
176
|
|
|
|
|
|
|
min_q => 10000, # defaults to 1 |
177
|
|
|
|
|
|
|
system => 30000142, |
178
|
|
|
|
|
|
|
regions => 10000002, # or [10000002, 10000003], |
179
|
|
|
|
|
|
|
)->request |
180
|
|
|
|
|
|
|
); |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head2 quicklookpath |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
my $xml = $client->quicklookpath( |
185
|
|
|
|
|
|
|
Games::EveOnline::EveCentral::Request::QuickLookPath->new( |
186
|
|
|
|
|
|
|
type_id => 34, # Mandatory |
187
|
|
|
|
|
|
|
from_system => 'Jita', # or 30000142, mandatory |
188
|
|
|
|
|
|
|
to_system => 'Amarr', # or 30002187, mandatory |
189
|
|
|
|
|
|
|
hours => 37, # Defaults to 360 |
190
|
|
|
|
|
|
|
min_q => 100 # Defaults to 1 |
191
|
|
|
|
|
|
|
)->request |
192
|
|
|
|
|
|
|
); |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head2 history |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
my $json = $client->history( |
197
|
|
|
|
|
|
|
Games::EveOnline::EveCentral::Request::History->new( |
198
|
|
|
|
|
|
|
type_id => 34, # Mandatory |
199
|
|
|
|
|
|
|
location_type => 'system', # or 'region'. |
200
|
|
|
|
|
|
|
location => 'Jita', # Or 30000142, must be present if location_type is |
201
|
|
|
|
|
|
|
bid => 'buy' # Or 'sell', mandatory |
202
|
|
|
|
|
|
|
)->request |
203
|
|
|
|
|
|
|
); |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head2 evemon |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
my $xml = $client->evemon( |
208
|
|
|
|
|
|
|
Games::EveOnline::EveCentral::Request::EVEMon->new->request |
209
|
|
|
|
|
|
|
); |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head2 route |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
my $json = $client->route( |
214
|
|
|
|
|
|
|
Games::EveOnline::EveCentral::Request::Route->new( |
215
|
|
|
|
|
|
|
from_system => 'Jita', # Or 30000142, mandatory |
216
|
|
|
|
|
|
|
to_system => 'Amarr', # Or 30002187, mandatory |
217
|
|
|
|
|
|
|
)->request |
218
|
|
|
|
|
|
|
); |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=begin private |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=end private |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=head1 AUTHOR |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Pedro Figueiredo, C<< <me at pedrofigueiredo.org> >> |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=head1 BUGS |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
Please report any bugs or feature requests through the web interface at |
231
|
|
|
|
|
|
|
L<https://github.com/pfig/games-eveonline-evecentral/issues>. I will be |
232
|
|
|
|
|
|
|
notified, and then you'll automatically be notified of progress on your bug as |
233
|
|
|
|
|
|
|
I make changes. |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=head1 SUPPORT |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
perldoc Games::EveOnline::EveCentral |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
You can also look for information at: |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=over 4 |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=item * GitHub Issues (report bugs here) |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
L<https://github.com/pfig/games-eveonline-evecentral/issues> |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
L<http://annocpan.org/dist/Games-EveOnline-EveCentral> |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=item * CPAN Ratings |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
L<http://cpanratings.perl.org/d/Games-EveOnline-EveCentral> |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=item * CPAN |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
L<http://metacpan.org/module/Games::EveOnline::EveCentral> |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=back |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=over 4 |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=item * The people behind EVE Central. |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
L<http://eve-central.com/> |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=back |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
Copyright 2013 Pedro Figueiredo. |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
278
|
|
|
|
|
|
|
under the terms of the Artistic License. |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=head1 AUTHOR |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
Pedro Figueiredo <me@pedrofigueiredo.org> |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
This software is copyright (c) 2013 by Pedro Figueiredo. |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
291
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=cut |