186 lines
4.6 KiB
HTML
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"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
IO::Socket::SSL::PublicSuffix - provide access to Mozilla's list of effective TLD names
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
# use builtin default
|
|
use IO::Socket::SSL::PublicSuffix;
|
|
$ps = IO::Socket::SSL::PublicSuffix->default;
|
|
|
|
# load from string
|
|
$ps = IO::Socket::SSL::PublicSuffix->from_string("*.uk\n*");
|
|
|
|
# load from file or file handle
|
|
$ps = IO::Socket::SSL::PublicSuffix->from_file($filename);
|
|
$ps = IO::Socket::SSL::PublicSuffix->from_file(\*STDIN);
|
|
|
|
|
|
# --- string in -> string out
|
|
# $rest -> whatever.host
|
|
# $tld -> co.uk
|
|
my ($rest,$tld) = $ps->public_suffix('whatever.host.co.uk');
|
|
my $tld = $ps->public_suffix('whatever.host.co.uk');
|
|
|
|
# $root_domain -> host.co.uk
|
|
my $root_domain = $ps->public_suffix('whatever.host.co.uk', 1);
|
|
|
|
# --- array in -> array out
|
|
# $rest -> [qw(whatever host)]
|
|
# $tld -> [qw(co uk)]
|
|
my ($rest,$tld) = $ps->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"> </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"> </A>
|
|
<H3>Method</H3>
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">class->default(%args)<DD>
|
|
|
|
|
|
Returns object with builtin default.
|
|
<TT>"min_suffix"</TT> can be given in <TT>%args</TT> to specify the minimal suffix, default
|
|
is 1.
|
|
<DT id="2">class->from_string(string,%args)<DD>
|
|
|
|
|
|
Returns object with configuration from string.
|
|
See method <TT>"default"</TT> for <TT>%args</TT>.
|
|
<DT id="3">class->from_file( file name| file handle, %args )<DD>
|
|
|
|
|
|
|
|
|
|
Returns object with configuration from file or file handle.
|
|
See method <TT>"default"</TT> for <TT>%args</TT>.
|
|
<DT id="4">$self->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>"$add=1"</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>"."</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>"xn--"</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)->can_idn<DD>
|
|
|
|
|
|
Returns true if <FONT SIZE="-1">IDN</FONT> support is available.
|
|
</DL>
|
|
<A NAME="lbAF"> </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"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
|
|
Domain::PublicSuffix, Mozilla::PublicSuffix
|
|
<A NAME="lbAH"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
Q: Why yet another module, we already have L<Domain::PublicSuffix> and
|
|
L<Mozilla::PublicSuffix>.
|
|
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"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
|
|
|
|
Steffen Ullrich
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </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>
|