| 1 | package Net::Duowan::DNS::Common; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use Carp qw/croak/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use JSON; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use HTTP::Request::Common qw(POST); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 2 | ▶ | use LWP::UserAgent; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 2 | ▶ | use vars qw/$VERSION/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 2 | $VERSION = '1.2.0'; | |||||||||
| 13 | |||||||||||
| 14 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 15 | 0 | my $class = shift; | |||||||||
| 16 | 0 | bless {},$class; | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 0 | ▶ | sub reqTemplate { | ||||||||
|
Subroutine
reqTemplate: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 20 | 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 | ▶ | if ($res->is_success ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | return from_json( $res->decoded_content ); | |||||||||
| 33 | } else { | ||||||||||
| 34 | 0 | croak $res->status_line; | |||||||||
| 35 | } | ||||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 2 | 1; | |||||||||