line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::LogicBoxes::DomainAvailability; |
2
|
|
|
|
|
|
|
|
3
|
41
|
|
|
41
|
|
556344
|
use strict; |
|
41
|
|
|
|
|
129
|
|
|
41
|
|
|
|
|
1421
|
|
4
|
41
|
|
|
41
|
|
248
|
use warnings; |
|
41
|
|
|
|
|
105
|
|
|
41
|
|
|
|
|
1186
|
|
5
|
|
|
|
|
|
|
|
6
|
41
|
|
|
41
|
|
1388
|
use Moose; |
|
41
|
|
|
|
|
679996
|
|
|
41
|
|
|
|
|
371
|
|
7
|
41
|
|
|
41
|
|
298955
|
use MooseX::StrictConstructor; |
|
41
|
|
|
|
|
81376
|
|
|
41
|
|
|
|
|
378
|
|
8
|
41
|
|
|
41
|
|
165902
|
use MooseX::Aliases; |
|
41
|
|
|
|
|
5187
|
|
|
41
|
|
|
|
|
351
|
|
9
|
41
|
|
|
41
|
|
369248
|
use namespace::autoclean; |
|
41
|
|
|
|
|
132
|
|
|
41
|
|
|
|
|
450
|
|
10
|
|
|
|
|
|
|
|
11
|
41
|
|
|
41
|
|
5927
|
use WWW::LogicBoxes::Types qw( Bool DomainName Str ); |
|
41
|
|
|
|
|
133
|
|
|
41
|
|
|
|
|
416
|
|
12
|
|
|
|
|
|
|
|
13
|
41
|
|
|
41
|
|
445613
|
use Mozilla::PublicSuffix; |
|
41
|
|
|
|
|
78055
|
|
|
41
|
|
|
|
|
11486
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '1.11.0'; # VERSION |
16
|
|
|
|
|
|
|
# ABSTRACT: LogicBoxes Domain Availability Response |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has name => ( |
19
|
|
|
|
|
|
|
is => 'ro', |
20
|
|
|
|
|
|
|
isa => DomainName, |
21
|
|
|
|
|
|
|
required => 1, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has is_available => ( |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
isa => Bool, |
27
|
|
|
|
|
|
|
required => 1, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has sld => ( |
31
|
|
|
|
|
|
|
is => 'ro', |
32
|
|
|
|
|
|
|
isa => Str, |
33
|
|
|
|
|
|
|
builder => '_build_sld', |
34
|
|
|
|
|
|
|
lazy => 1, |
35
|
|
|
|
|
|
|
init_arg => undef, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has public_suffix => ( |
39
|
|
|
|
|
|
|
is => 'ro', |
40
|
|
|
|
|
|
|
isa => Str, |
41
|
|
|
|
|
|
|
alias => 'tld', |
42
|
|
|
|
|
|
|
builder => '_build_public_suffix', |
43
|
|
|
|
|
|
|
lazy => 1, |
44
|
|
|
|
|
|
|
init_arg => undef, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
48
|
|
|
|
|
|
|
sub _build_sld { |
49
|
4
|
|
|
4
|
|
8
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
4
|
|
|
|
|
142
|
return substr( $self->name, 0, length( $self->name ) - ( length( $self->public_suffix ) + 1 ) ); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
## use critic |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
56
|
|
|
|
|
|
|
sub _build_public_suffix { |
57
|
4
|
|
|
4
|
|
42
|
my $self = shift; |
58
|
|
|
|
|
|
|
|
59
|
4
|
|
|
|
|
126
|
return Mozilla::PublicSuffix::public_suffix( $self->name ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
## use critic |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |
68
|
|
|
|
|
|
|
=pod |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 NAME |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
WWW::LogicBoxes::DomainAvailability |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SYNOPSIS |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
use WWW::LogicBoxes; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
my $logic_boxes = WWW::LogicBoxes->new( ... ); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my $domain_availabilities = $logic_boxes->check_domain_availability( |
81
|
|
|
|
|
|
|
slds => [qw( cpan drzigman brainstormincubator ], |
82
|
|
|
|
|
|
|
tlds => [qw( com net org )], |
83
|
|
|
|
|
|
|
suggestions => 0, |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
for my $domain_availability (@{ $domain_availabilities }) { |
87
|
|
|
|
|
|
|
if ( $domain_availability->is_available ) { |
88
|
|
|
|
|
|
|
print 'Domain: ' . $domain_availability->name . " is available! :) \n"; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
else { |
91
|
|
|
|
|
|
|
print 'Domain: ' . $domain_availability->name . " is not available! :( \n"; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 DESCRIPTION |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Contains details about the availability of a domain. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 B<name> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
The full domain name (test-domain.com). |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 B<is_available> |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Boolean indicating if this domain is available for registration. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 sld |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
The portion of the domain name excluding the public_suffix, (test-domain). |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 public_suffix |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
The "root" of the domain (.com). There is an alias of tld to this attribute. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
B<NOTE> For domains like test-domain.co.uk the public_suffix is .co.uk. The public suffix is what is available for someone to actually register. For additional information between the distinction between Top Level Domain and Public Suffix please see L<https://publicsuffix.org/learn/> |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |