| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::Domain::Info; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
126209
|
use Class::Easy; |
|
|
3
|
|
|
|
|
103499
|
|
|
|
3
|
|
|
|
|
30
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
5211
|
use Net::Domain::Info::IDN; |
|
|
3
|
|
|
|
|
16
|
|
|
|
3
|
|
|
|
|
219
|
|
|
6
|
3
|
|
|
3
|
|
4063
|
use Encode; |
|
|
3
|
|
|
|
|
38671
|
|
|
|
3
|
|
|
|
|
375
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
29
|
use vars qw($VERSION); |
|
|
3
|
|
|
|
|
29
|
|
|
|
3
|
|
|
|
|
2377
|
|
|
9
|
|
|
|
|
|
|
$VERSION = '0.02'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'idn'; |
|
12
|
|
|
|
|
|
|
has 'name'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub import { |
|
15
|
|
|
|
|
|
|
# this class doesn't export any functions as long as it's |
|
16
|
|
|
|
|
|
|
# completely object oriented, but with help of export list |
|
17
|
|
|
|
|
|
|
# you can configure which plug-ins to use |
|
18
|
|
|
|
|
|
|
# use Net::Domain::Info qw(::Whois); # used Net::Domain::Info::Whois plugin |
|
19
|
|
|
|
|
|
|
|
|
20
|
3
|
|
|
3
|
|
25
|
my $package = shift; |
|
21
|
3
|
|
|
|
|
11
|
my @plugins = @_; |
|
22
|
|
|
|
|
|
|
|
|
23
|
3
|
|
|
|
|
8
|
foreach my $plugin_tag (@plugins) { |
|
24
|
|
|
|
|
|
|
|
|
25
|
6
|
|
|
|
|
90
|
my $plugin = $plugin_tag; |
|
26
|
6
|
50
|
|
|
|
39
|
$plugin = "${package}${plugin_tag}" |
|
27
|
|
|
|
|
|
|
if $plugin_tag =~ /^::/; |
|
28
|
6
|
100
|
|
|
|
25
|
die "can't require package '$plugin'" |
|
29
|
|
|
|
|
|
|
unless try_to_use ($plugin); |
|
30
|
|
|
|
|
|
|
|
|
31
|
3
|
50
|
|
|
|
252
|
warn "plugin '$plugin' must contain '_init' method, skipped" |
|
32
|
|
|
|
|
|
|
unless $plugin->can ('_init'); |
|
33
|
|
|
|
|
|
|
|
|
34
|
3
|
|
|
|
|
16
|
$plugin->_init ($package); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub new { |
|
39
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
|
40
|
0
|
|
|
|
|
|
my $domain = shift; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# if idn prefixed with xn--, then reverse-decode must occur |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my $object = {idn => $domain}; |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
0
|
0
|
|
|
|
if ( |
|
|
|
0
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
$domain =~ /^$Net::IDN::Encode::IDNA_prefix/ |
|
48
|
|
|
|
|
|
|
and $domain =~ /^([0-9a-z]+[0-9a-z\-]+\.)+[0-9a-z]+[0-9a-z\-]+$/i |
|
49
|
|
|
|
|
|
|
) { |
|
50
|
0
|
|
|
|
|
|
$object->{name} = $domain; |
|
51
|
0
|
|
|
|
|
|
$object->{idn} = Net::IDN::Encode::domain_to_unicode ($domain); |
|
52
|
|
|
|
|
|
|
} elsif ($domain !~ /^([0-9a-z]+[0-9a-z\-]+\.)+[0-9a-z]+[0-9a-z\-]+$/i) { |
|
53
|
0
|
0
|
|
|
|
|
unless (Encode::is_utf8 ($domain)) { |
|
54
|
0
|
|
|
|
|
|
$domain = Encode::decode_utf8 ($domain); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
$object->{name} = Net::IDN::Encode::domain_to_ascii ( |
|
58
|
|
|
|
|
|
|
$domain |
|
59
|
|
|
|
|
|
|
); |
|
60
|
0
|
|
|
|
|
|
$object->{idn} = $domain; |
|
61
|
|
|
|
|
|
|
} else { |
|
62
|
0
|
|
|
|
|
|
$object->{name} = $domain; |
|
63
|
0
|
|
|
|
|
|
$object->{idn} = $domain; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
bless $object, $class; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 NAME |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Net::Domain::Info - request for domain information like whois, dns, seo |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
If you use just this module, then you receive only IDNA domain support. |
|
78
|
|
|
|
|
|
|
The main power of this module is contained in plugins. Usage of plugins is simple: |
|
79
|
|
|
|
|
|
|
you need provide their names in the import list. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
use Net::Domain::Info qw(::Whois ::SEO); # used Whois and SEO plugins |
|
82
|
|
|
|
|
|
|
use Encode; |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $domain_raw = 'нфтвучюкг.com'; |
|
85
|
|
|
|
|
|
|
my $domain_idn = Encode::decode_utf8 ($domain_raw); |
|
86
|
|
|
|
|
|
|
my $domain_asc = 'xn--b1acukzhe1a7d.com'; |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
my $domain_info = Net::Domain::Info->new ($domain_idn); |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
ok $domain_info; |
|
91
|
|
|
|
|
|
|
ok $domain_info->name eq $domain_asc; |
|
92
|
|
|
|
|
|
|
ok $domain_info->idn eq $domain_idn; |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 METHODS |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 new |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Creates domain info object. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 name |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Returns ASCII representation of domain name. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 idn |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Returns IDNA representation of domain name. |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 AUTHOR |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Ivan Baktsheev, C<< >> |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 BUGS |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Please report any bugs or feature requests to my email address, |
|
121
|
|
|
|
|
|
|
or through the web interface at L. |
|
122
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified |
|
123
|
|
|
|
|
|
|
of progress on your bug as I make changes. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 SUPPORT |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Copyright 2008 Ivan Baktsheev |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
138
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |