DNS-PunyDNS
view release on metacpan or search on metacpan
lib/DNS/PunyDNS.pm view on Meta::CPAN
202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
if
(
ref
(
$response
->{
'domains'
} ) eq
'ARRAY'
) {
push
@domains
, @{
$response
->{
'domain'
} };
}
else
{
push
@domains
,
$response
->{
'domain'
};
}
}
return
\
@domains
;
}
sub
_build_request {
my
(
$self
,
$endpoint
,
$args
) =
@_
;
$args
->{
'ESBUsername'
} =
$self
->{
'username'
};
$args
->{
'ESBPassword'
} =
$self
->{
'password'
};
$args
->{
'lang'
} =
'en'
;
my
@keys
=
keys
%{
$args
};
my
$url
=
$BASE_URL
.
$endpoint
.
'?'
.
join
(
'&'
,
map
{
$_
.
'='
.
$args
->{
$_
} }
@keys
);
return
$url
;
}
sub
_get_it {
my
(
$self
,
$endpoint
,
$args
) =
@_
;
my
$url
=
$self
->_build_request(
$endpoint
,
$args
);
delete
$self
->{
'error'
};
my
$ua
= new LWP::UserAgent();
my
$req
= new HTTP::Request(
'GET'
,
$url
);
my
$response
=
$ua
->request(
$req
);
if
(
$response
->is_success ) {
my
$content
=
$response
->content;
my
$decoded_content
= XMLin( \
$content
,
KeyAttr
=>
'domain'
);
if
(
$decoded_content
->{
'error'
} ) {
( run in 0.295 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )