Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Domain-PublicSuffix CPAN distribution.

Report information
The Basics
Id: 41221
Status: open
Priority: 0/
Queue: Domain-PublicSuffix

People
Owner: Nobody in particular
Requestors: rjbs [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: suffix doesn't seem to work as described
Download (untitled) / with headers
text/plain 225b
use strict; use Domain::PublicSuffix 0.04; my $dps = Domain::PublicSuffix->new; # or ->new({}) printf "%s\n", $dps->suffix('google.co.uk'); This prints 'google.co.uk' but the docs suggest it should be co.uk -- rjbs
Download (untitled) / with headers
text/plain 791b
On Tue Nov 25 15:46:09 2008, RJBS wrote: Show quoted text
> use strict; > use Domain::PublicSuffix 0.04; > my $dps = Domain::PublicSuffix->new; # or ->new({}) > printf "%s\n", $dps->suffix('google.co.uk');
Boggle. I think this is both a doc and API problem: DB<9> x $dps->get_root_domain('google.co.uk') 0 'google.co.uk' DB<10> x $dps->suffix 0 'co.uk' DB<11> x $dps->suffix('google.co.uk') 0 'google.co.uk' This is really counter-intuitive. I think you should have some methods that take a domain and return results and maybe on that returns an aggregate object that can be queried for results. In general, I think you will find that objects that go: $obj->analyze($x); $obj->result_of_analysis; Are much more hateful than: my $result = $obj->analyze($x); -- rjbs
From: nick [...] abstractwankery.com
Download (untitled) / with headers
text/plain 714b
Hi there! For suffix to work as expected, you will have to first parse the domain name using get_root_domain. This is just a result of not overloading the accessor on my part, but what you're doing is setting suffix to 'google.co.uk', and it's returning that. Proper use here would be: use strict; use Domain::PublicSuffix; my $dps = Domain::PublicSuffix->new(); $dps->get_root_domain('google.co.uk'); printf( "%s\n", $dps->suffix() ); On Tue Nov 25 15:46:09 2008, RJBS wrote: Show quoted text
> use strict; > use Domain::PublicSuffix 0.04; > my $dps = Domain::PublicSuffix->new; # or ->new({}) > printf "%s\n", $dps->suffix('google.co.uk'); > > This prints 'google.co.uk' but the docs suggest it should be co.uk
From: nick [...] abstractwankery.com
Download (untitled) / with headers
text/plain 632b
On Tue Nov 25 15:55:34 2008, RJBS wrote: Show quoted text
> This is really counter-intuitive. I think you should have some methods > that take a domain and return results and maybe on that returns an > aggregate object that can be queried for results. In general, I think > you will find that objects that go: > > $obj->analyze($x); > $obj->result_of_analysis; > > Are much more hateful than: > > my $result = $obj->analyze($x);
This is true, but get_root_domain is effectively the 'analyze' method, and the return is the most commonly used response required from the method. I will take this under consideration for the next release.
Subject: Re: [rt.cpan.org #41221] suffix doesn't seem to work as described
Date: Tue, 25 Nov 2008 16:01:20 -0500
To: Nicholas Melnick via RT <bug-Domain-PublicSuffix [...] rt.cpan.org>
From: Ricardo SIGNES <rjbs [...] cpan.org>
Download (untitled) / with headers
text/plain 779b
* Nicholas Melnick via RT <bug-Domain-PublicSuffix@rt.cpan.org> [2008-11-25T15:56:52] Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=41221 > > > Hi there! > > For suffix to work as expected, you will have to first parse the domain name > using get_root_domain. This is just a result of not overloading the accessor > on my part, but what you're doing is setting suffix to 'google.co.uk', and > it's returning that. Proper use here would be:
Yeah, I think our replies crossed in the mail. I find this interface so troublesome that I think you should consider avoiding storing this kind of state on the object itself. I'm not sure what you mean by "overloading the accessor." Would you be willing to accept patches that make this interface more straightforward? -- rjbs


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.