man-pages/man3/IO::Socket::SSL::PublicSuffix.3pm.html
2021-03-31 01:06:50 +01:00

186 lines
4.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of IO::Socket::SSL::PublicSuffix</TITLE>
</HEAD><BODY>
<H1>IO::Socket::SSL::PublicSuffix</H1>
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2020-02-14<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
IO::Socket::SSL::PublicSuffix - provide access to Mozilla's list of effective TLD names
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
# use builtin default
use IO::Socket::SSL::PublicSuffix;
$ps = IO::Socket::SSL::PublicSuffix-&gt;default;
# load from string
$ps = IO::Socket::SSL::PublicSuffix-&gt;from_string(&quot;*.uk\n*&quot;);
# load from file or file handle
$ps = IO::Socket::SSL::PublicSuffix-&gt;from_file($filename);
$ps = IO::Socket::SSL::PublicSuffix-&gt;from_file(\*STDIN);
# --- string in -&gt; string out
# $rest -&gt; whatever.host
# $tld -&gt; co.uk
my ($rest,$tld) = $ps-&gt;public_suffix('whatever.host.co.uk');
my $tld = $ps-&gt;public_suffix('whatever.host.co.uk');
# $root_domain -&gt; host.co.uk
my $root_domain = $ps-&gt;public_suffix('whatever.host.co.uk', 1);
# --- array in -&gt; array out
# $rest -&gt; [qw(whatever host)]
# $tld -&gt; [qw(co uk)]
my ($rest,$tld) = $ps-&gt;public_suffix([qw(whatever host co uk)]);
----
# To update this file with the current list:
perl -MIO::Socket::SSL::PublicSuffix -e 'IO::Socket::SSL::PublicSuffix::update_self_from_url()'
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
This module uses the list of effective top level domain names from the mozilla
project to determine the public top level domain for a given hostname.
<A NAME="lbAE">&nbsp;</A>
<H3>Method</H3>
<DL COMPACT>
<DT id="1">class-&gt;default(%args)<DD>
Returns object with builtin default.
<TT>&quot;min_suffix&quot;</TT> can be given in <TT>%args</TT> to specify the minimal suffix, default
is 1.
<DT id="2">class-&gt;from_string(string,%args)<DD>
Returns object with configuration from string.
See method <TT>&quot;default&quot;</TT> for <TT>%args</TT>.
<DT id="3">class-&gt;from_file( file name| file handle, %args )<DD>
Returns object with configuration from file or file handle.
See method <TT>&quot;default&quot;</TT> for <TT>%args</TT>.
<DT id="4">$self-&gt;public_suffix( $host|\@host, [ $add ] )<DD>
In array context the function returns the non-tld part and the tld part of the
given hostname, in scalar context only the tld part.
It adds <TT>$add</TT> parts of the non-tld part to the tld, e.g. with <TT>&quot;$add=1&quot;</TT> it
will return the root domain.
<P>
If there were no explicit matches against the public suffix configuration it
will fall back to a suffix of length 1.
<P>
The function accepts a string or an array-ref (e.g. host split by <TT>&quot;.&quot;</TT>). In the
first case it will return string(s), in the latter case array-ref(s).
<P>
International hostnames or labels can be in <FONT SIZE="-1">ASCII</FONT> (<FONT SIZE="-1">IDNA</FONT> form starting with
<TT>&quot;xn--&quot;</TT>) or unicode. In the latter case an <FONT SIZE="-1">IDNA</FONT> handling library like
Net::IDN:::Encode, Net::LibIDN or recent versions of <FONT SIZE="-1">URI</FONT> need to be
installed.
<DT id="5">($self|class)-&gt;can_idn<DD>
Returns true if <FONT SIZE="-1">IDN</FONT> support is available.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>FILES</H2>
<A HREF="http://publicsuffix.org/list/effective_tld_names.dat">http://publicsuffix.org/list/effective_tld_names.dat</A>
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
Domain::PublicSuffix, Mozilla::PublicSuffix
<A NAME="lbAH">&nbsp;</A>
<H2>BUGS</H2>
<PRE>
Q: Why yet another module, we already have L&lt;Domain::PublicSuffix&gt; and
L&lt;Mozilla::PublicSuffix&gt;.
A: Because the public suffix data change more often than these modules do,
IO::Socket::SSL needs this list and it is more easy this way to keep it
up-to-date.
</PRE>
<A NAME="lbAI">&nbsp;</A>
<H2>AUTHOR</H2>
Steffen Ullrich
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="6"><A HREF="#lbAB">NAME</A><DD>
<DT id="7"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="8"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DL>
<DT id="9"><A HREF="#lbAE">Method</A><DD>
</DL>
<DT id="10"><A HREF="#lbAF">FILES</A><DD>
<DT id="11"><A HREF="#lbAG">SEE ALSO</A><DD>
<DT id="12"><A HREF="#lbAH">BUGS</A><DD>
<DT id="13"><A HREF="#lbAI">AUTHOR</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:46 GMT, March 31, 2021
</BODY>
</HTML>