Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server in URL not being set #2

Open
whosgonna opened this issue Jul 15, 2017 · 1 comment
Open

Server in URL not being set #2

whosgonna opened this issue Jul 15, 2017 · 1 comment

Comments

@whosgonna
Copy link

When running:

#!/usr/bin/env perl
use WebService::DNSMadeEasy;

my $dns = WebService::DNSMadeEasy->new({
        api_key => $my_api_key,
        secret  => $my_secret,
        sandbox => 1,     # defaults to 0
});

my @domains = $dns->managed_domains;

I get the following failure:

"Cannot parse URL: '/dns/managed'
"
HTTP request failed
Request:  GET /dns/managed
Response: 599 Internal Exception
Cannot parse URL: '/dns/managed'

It looks like the issue is that the override of the server attribute in WebService/DNSMadeEasy/Client.pm is not executing it's builder. I'm not sure why this is, and i tried disabling lazy, and explicitly referencing the builder (builder = _build_server), but no luck with these.

I was able to get it to work by using a default instead, changing the line

has '+server'         => (builder => 1, lazy => 1);

in Client.pm to the following:

has '+server'         => (default => sub {
    my $self = shift;
    return _build_server($self);
});

If you're ok with this as a fix, I can submit a PR, however it might make more sense to re-name the _build_server subroutine since it's not technically the builder for the attribute any more. Alternately, the ternary condition to return the sandbox vs. live URL could just be put into the subroutine for the default.

@kablamo
Copy link
Owner

kablamo commented Jul 17, 2017

Thanks for this. Maybe put the ternary into the default? I'lll merge whatever you think is best and works. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants