{
    "mode": "perldoc",
    "parameter": "IO::Socket::SSL::PublicSuffix",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/IO%3A%3ASocket%3A%3ASSL%3A%3APublicSuffix/json",
    "generated": "2026-06-09T18:49:38Z",
    "synopsis": "# use builtin default\nuse IO::Socket::SSL::PublicSuffix;\n$ps = IO::Socket::SSL::PublicSuffix->default;\n# load from string\n$ps = IO::Socket::SSL::PublicSuffix->fromstring(\"*.uk\\n*\");\n# load from file or file handle\n$ps = IO::Socket::SSL::PublicSuffix->fromfile($filename);\n$ps = IO::Socket::SSL::PublicSuffix->fromfile(\\*STDIN);\n# --- string in -> string out\n# $rest -> whatever.host\n# $tld  -> co.uk\nmy ($rest,$tld) = $ps->publicsuffix('whatever.host.co.uk');\nmy $tld = $ps->publicsuffix('whatever.host.co.uk');\n# $rootdomain -> host.co.uk\nmy $rootdomain = $ps->publicsuffix('whatever.host.co.uk', 1);\n# --- array in -> array out\n# $rest -> [qw(whatever host)]\n# $tld  -> [qw(co uk)]\nmy ($rest,$tld) = $ps->publicsuffix([qw(whatever host co uk)]);\n----\n# To update this file with the current list:\nperl -MIO::Socket::SSL::PublicSuffix -e 'IO::Socket::SSL::PublicSuffix::updateselffromurl()'",
    "sections": {
        "NAME": {
            "content": "IO::Socket::SSL::PublicSuffix - provide access to Mozilla's list of effective TLD names\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "# use builtin default\nuse IO::Socket::SSL::PublicSuffix;\n$ps = IO::Socket::SSL::PublicSuffix->default;\n\n# load from string\n$ps = IO::Socket::SSL::PublicSuffix->fromstring(\"*.uk\\n*\");\n\n# load from file or file handle\n$ps = IO::Socket::SSL::PublicSuffix->fromfile($filename);\n$ps = IO::Socket::SSL::PublicSuffix->fromfile(\\*STDIN);\n\n\n# --- string in -> string out\n# $rest -> whatever.host\n# $tld  -> co.uk\nmy ($rest,$tld) = $ps->publicsuffix('whatever.host.co.uk');\nmy $tld = $ps->publicsuffix('whatever.host.co.uk');\n\n# $rootdomain -> host.co.uk\nmy $rootdomain = $ps->publicsuffix('whatever.host.co.uk', 1);\n\n# --- array in -> array out\n# $rest -> [qw(whatever host)]\n# $tld  -> [qw(co uk)]\nmy ($rest,$tld) = $ps->publicsuffix([qw(whatever host co uk)]);\n\n----\n\n# To update this file with the current list:\nperl -MIO::Socket::SSL::PublicSuffix -e 'IO::Socket::SSL::PublicSuffix::updateselffromurl()'\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module uses the list of effective top level domain names from the mozilla project to\ndetermine the public top level domain for a given hostname.\n",
            "subsections": [
                {
                    "name": "Method",
                    "content": "class->default(%args)\nReturns object with builtin default. \"minsuffix\" can be given in %args to specify the\nminimal suffix, default is 1.\n\nclass->fromstring(string,%args)\nReturns object with configuration from string. See method \"default\" for %args.\n\nclass->fromfile( file name| file handle, %args )\nReturns object with configuration from file or file handle. See method \"default\" for %args.\n\n$self->publicsuffix( $host|\\@host, [ $add ] )\nIn array context the function returns the non-tld part and the tld part of the given\nhostname, in scalar context only the tld part. It adds $add parts of the non-tld part to the\ntld, e.g. with \"$add=1\" it will return the root domain.\n\nIf there were no explicit matches against the public suffix configuration it will fall back\nto a suffix of length 1.\n\nThe function accepts a string or an array-ref (e.g. host split by \".\"). In the first case it\nwill return string(s), in the latter case array-ref(s).\n\nInternational hostnames or labels can be in ASCII (IDNA form starting with \"xn--\") or\nunicode. In the latter case an IDNA handling library needs to be available. URI is\npreferred, but Net::IDN:::Encode, Net::LibIDN are still supported.\n\n($self|class)->canidn\nReturns true if IDN support is available.\n"
                }
            ]
        },
        "FILES": {
            "content": "http://publicsuffix.org/list/effectivetldnames.dat\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Domain::PublicSuffix, Mozilla::PublicSuffix\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Q: Why yet another module, we already have L<Domain::PublicSuffix> and\nL<Mozilla::PublicSuffix>.\nA: Because the public suffix data change more often than these modules do,\nIO::Socket::SSL needs this list and it is more easy this way to keep it\nup-to-date.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Steffen Ullrich\n",
            "subsections": []
        }
    },
    "summary": "IO::Socket::SSL::PublicSuffix - provide access to Mozilla's list of effective TLD names",
    "flags": [],
    "examples": [],
    "see_also": []
}