line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Duowan::DNS::Common; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
17
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp qw/croak/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
45
|
|
7
|
1
|
|
|
1
|
|
5
|
use JSON; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
938
|
use HTTP::Request::Common qw(POST); |
|
1
|
|
|
|
|
2012
|
|
|
1
|
|
|
|
|
63
|
|
9
|
1
|
|
|
1
|
|
5
|
use LWP::UserAgent; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
6
|
use vars qw/$VERSION/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
198
|
|
12
|
|
|
|
|
|
|
$VERSION = '1.2.0'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
16
|
0
|
|
|
|
|
|
bless {},$class; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub reqTemplate { |
20
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
21
|
0
|
|
|
|
|
|
my %args = @_; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my $url = 'https://cloudns.duowan.com/v1.2/api/'; |
24
|
0
|
|
|
|
|
|
my $ua = LWP::UserAgent->new; |
25
|
0
|
|
|
|
|
|
$ua->timeout(30); |
26
|
0
|
|
|
|
|
|
$ua->ssl_opts(verify_hostname => 0); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $req = POST $url, [ %args ]; |
29
|
0
|
|
|
|
|
|
my $res = $ua->request($req); |
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
if ($res->is_success ) { |
32
|
0
|
|
|
|
|
|
return from_json( $res->decoded_content ); |
33
|
|
|
|
|
|
|
} else { |
34
|
0
|
|
|
|
|
|
croak $res->status_line; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |