1IO::Socket::SSL::PublicUSsuefrfiCxo(n3t)ributed Perl DocIuOm:e:nStoactkieotn::SSL::PublicSuffix(3)
2
3
4

NAME

6       IO::Socket::SSL::PublicSuffix - provide access to Mozilla's list of
7       effective TLD names
8

SYNOPSIS

10           # use builtin default
11           use IO::Socket::SSL::PublicSuffix;
12           $ps = IO::Socket::SSL::PublicSuffix->default;
13
14           # load from string
15           $ps = IO::Socket::SSL::PublicSuffix->from_string("*.uk\n*");
16
17           # load from file or file handle
18           $ps = IO::Socket::SSL::PublicSuffix->from_file($filename);
19           $ps = IO::Socket::SSL::PublicSuffix->from_file(\*STDIN);
20
21
22           # --- string in -> string out
23           # $rest -> whatever.host
24           # $tld  -> co.uk
25           my ($rest,$tld) = $ps->public_suffix('whatever.host.co.uk');
26           my $tld = $ps->public_suffix('whatever.host.co.uk');
27
28           # $root_domain -> host.co.uk
29           my $root_domain = $ps->public_suffix('whatever.host.co.uk', 1);
30
31           # --- array in -> array out
32           # $rest -> [qw(whatever host)]
33           # $tld  -> [qw(co uk)]
34           my ($rest,$tld) = $ps->public_suffix([qw(whatever host co uk)]);
35
36        ----
37
38           # To update this file with the current list:
39           perl -MIO::Socket::SSL::PublicSuffix -e 'IO::Socket::SSL::PublicSuffix::update_self_from_url()'
40

DESCRIPTION

42       This module uses the list of effective top level domain names from the
43       mozilla project to determine the public top level domain for a given
44       hostname.
45
46   Method
47       class->default(%args)
48           Returns object with builtin default.  "min_suffix" can be given in
49           %args to specify the minimal suffix, default is 1.
50
51       class->from_string(string,%args)
52           Returns object with configuration from string.  See method
53           "default" for %args.
54
55       class->from_file( file name| file handle, %args )
56           Returns object with configuration from file or file handle.  See
57           method "default" for %args.
58
59       $self->public_suffix( $host|\@host, [ $add ] )
60           In array context the function returns the non-tld part and the tld
61           part of the given hostname, in scalar context only the tld part.
62           It adds $add parts of the non-tld part to the tld, e.g. with
63           "$add=1" it will return the root domain.
64
65           If there were no explicit matches against the public suffix
66           configuration it will fall back to a suffix of length 1.
67
68           The function accepts a string or an array-ref (e.g. host split by
69           "."). In the first case it will return string(s), in the latter
70           case array-ref(s).
71
72           International hostnames or labels can be in ASCII (IDNA form
73           starting with "xn--") or unicode. In the latter case an IDNA
74           handling library like Net::IDN:::Encode, Net::LibIDN or recent
75           versions of URI need to be installed.
76
77       ($self|class)->can_idn
78           Returns true if IDN support is available.
79

FILES

81       http://publicsuffix.org/list/effective_tld_names.dat
82

SEE ALSO

84       Domain::PublicSuffix, Mozilla::PublicSuffix
85

BUGS

87        Q: Why yet another module, we already have L<Domain::PublicSuffix> and
88           L<Mozilla::PublicSuffix>.
89        A: Because the public suffix data change more often than these modules do,
90           IO::Socket::SSL needs this list and it is more easy this way to keep it
91           up-to-date.
92

AUTHOR

94       Steffen Ullrich
95
96
97
98perl v5.28.1                      2019-02-26  IO::Socket::SSL::PublicSuffix(3)
Impressum