line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Dogechain::Base; |
2
|
|
|
|
|
|
|
$Finance::Dogechain::Base::VERSION = '1.20210524.0142'; |
3
|
1
|
|
|
1
|
|
4627
|
use Mojo::Base -base, -signatures; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
12
|
|
4
|
1
|
|
|
1
|
|
832
|
use Mojo::UserAgent; |
|
1
|
|
|
|
|
271299
|
|
|
1
|
|
|
|
|
18
|
|
5
|
1
|
|
|
1
|
|
58
|
use Net::SSLeay; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
302
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has 'ua' => sub { Mojo::UserAgent->new->max_redirects(3) }; |
8
|
|
|
|
|
|
|
has 'base_url' => sub { 'https://dogechain.info/api/v1' }; |
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
0
|
1
|
|
sub return_field_if_success($self, $url_path, $field) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
11
|
0
|
|
|
|
|
|
my $res = $self->ua->get( $self->base_url . $url_path )->result; |
12
|
|
|
|
|
|
|
|
13
|
0
|
0
|
|
|
|
|
if ($res->is_success) { |
14
|
0
|
|
|
|
|
|
my $json = $res->json; |
15
|
0
|
0
|
|
|
|
|
return $json->{$field} if $json->{success}; |
16
|
0
|
|
|
|
|
|
return 0; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
return; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
'to the moon'; |
23
|
|
|
|
|
|
|
__END__ |