NAME
Mozilla::PublicSuffix - Get a domain name's public suffix via Mozilla's Public Suffix List
SYNOPSIS
use feature "say";
use Mozilla::PublicSuffix "public_suffix";
say public_suffix("org"); # "org"
say public_suffix("perl.org"); # "org"
say public_suffix("perl.orc"); # undef
say public_suffix("ga.gov.au"); # "gov.au"
say public_suffix("ga.goo.au"); # undef
DESCRIPTION
This module provides a single function that returns the public suffix of a domain name by referencing a parsed copy of Mozilla's Public Suffix List (official website at http://publicsuffix.org). The algorithm is not the one prescribed on Mozilla's website, but a robust test battery included in this distribution should provide sufficient evidence that the one used in its placed is an acceptable substitute.
A copy of the official list is bundled with the distribution. As the official list continues to be updated, the bundled copy will inevitably fall out of date. Therefore, if the bundled copy of found to be over thirty days old, this distribution's installer provides the option to check for a new version of the list and download/use it if one is found.
FUNCTIONS
- public_suffix
-
Exported on request. Simply returns the public suffix of the passed argument, or
undef
if the public suffix is not found. Croaks if the passed argument is not a well-formed domain name.
SEE ALSO
- Domain::PublicSuffix
-
An alternative to this module, with an object-oriented interface and slightly difference interpretation of the rules Mozilla stipulates for determining a public suffix.
AUTHOR
Richard Simões <rsimoes AT cpan DOT org>
COPYRIGHT AND LICENSE
Copyright © 2012 Richard Simões. This module is released under the terms of the GNU Lesser General Public License v. 3.0 and may be modified and/or redistributed under the same or any compatible license.