Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
perl-net-rdap
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
CentralNic
perl-net-rdap
Commits
987d5930
Unverified
Commit
987d5930
authored
Aug 20, 2018
by
Gavin Brown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added
parent
33b30614
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
241 additions
and
0 deletions
+241
-0
SearchResult.pm
lib/Net/RDAP/SearchResult.pm
+65
-0
Service.pm
lib/Net/RDAP/Service.pm
+176
-0
No files found.
lib/Net/RDAP/SearchResult.pm
0 → 100644
View file @
987d5930
package
Net::RDAP::
SearchResult
;
use
base
qw(Net::RDAP::Object)
;
use
strict
;
sub
domains
{
$_
[
0
]
->
objects
('
Net::RDAP::Object::Domain
',
$_
[
0
]
->
{'
domainSearchResults
'})
}
sub
nameservers
{
$_
[
0
]
->
objects
('
Net::RDAP::Object::Nameserver
',
$_
[
0
]
->
{'
nameserverSearchResults
'})
}
sub
entities
{
$_
[
0
]
->
objects
('
Net::RDAP::Object::Entity
',
$_
[
0
]
->
{'
entitySearchResults
'})
}
1
;
__END__
=head1 NAME
L<Net::RDAP::Searchresult> - a module representing an RDAP search result.
=head1 DESCRIPTION
L<Net::RDAP::Searchresult> represents the results of an RDAP
search. Search result objects are return by the search methods of
L<Net::RDAP::Service>.
L<Net::RDAP::Searchresult> inherits from L<Net::RDAP::Object> so has
access to all that module's methods.
Other methods include:
$result->domains;
Returns an array of L<Net::RDAP::Object::Domain> objects which matched
the search parameters.
$result->nameservers;
Returns an array of L<Net::RDAP::Object::Nameserver> objects which matched
the search parameters.
$result->entities;
Returns an array of L<Net::RDAP::Object::Entities> objects which matched
the search parameters.
=head1 COPYRIGHT
Copyright 2018 CentralNic Ltd. All rights reserved.
=head1 LICENSE
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of the author not be used
in advertising or publicity pertaining to distribution of the software
without specific prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
=cut
lib/Net/RDAP/Service.pm
0 → 100644
View file @
987d5930
package
Net::RDAP::
Service
;
use
Clone
qw(clone)
;
use
Net::
RDAP
;
use
strict
;
sub
new
{
my
(
$package
,
$base
,
$client
)
=
@_
;
return
bless
({
'
base
'
=>
$base
->
isa
('
REF
')
?
$base
:
URI
->
new
(
$base
),
'
client
'
=>
$client
||
Net::
RDAP
->
new
,
},
$package
);
}
sub
domain
{
$_
[
0
]
->
fetch
('
domain
',
$_
[
1
]
->
name
)
}
sub
ip
{
$_
[
0
]
->
fetch
('
ip
',
$_
[
1
]
->
prefix
)
}
sub
autnum
{
$_
[
0
]
->
fetch
('
autnum
',
$_
[
1
]
->
toasplain
)
}
sub
entity
{
$_
[
0
]
->
fetch
('
entity
',
$_
[
1
]
->
handle
)
}
sub
nameserver
{
$_
[
0
]
->
fetch
('
nameserver
',
$_
[
1
]
->
name
)
}
sub
fetch
{
my
(
$self
,
$type
,
$handle
,
%
params
)
=
@_
;
my
$uri
=
clone
(
$self
->
base
);
$uri
->
path_segments
(
grep
{
defined
}
(
$uri
->
path_segments
,
$type
,
$handle
));
$uri
->
query_form
(
%
params
);
return
$self
->
client
->
fetch
(
$uri
);
}
sub
base
{
$_
[
0
]
->
{'
base
'}
}
sub
client
{
$_
[
0
]
->
{'
client
'}
}
sub
domains
{
$_
[
0
]
->
fetch
('
domains
',
undef
,
$_
[
1
]
=>
$_
[
2
])
}
sub
nameservers
{
$_
[
0
]
->
fetch
('
nameservers
',
undef
,
$_
[
1
]
=>
$_
[
2
])
}
sub
entities
{
$_
[
0
]
->
fetch
('
entities
',
undef
,
$_
[
1
]
=>
$_
[
2
])
}
1
;
__END__
=pod
=head1 NAME
L<Net::RDAP::Service> - an interface to an RDAP server.
=head1 SYNOPSIS
use Net::RDAP::Service;
#
# create a new service object:
#
my $svc = Net::RDAP::Service->new('https://www.example.com/rdap');
#
# get a domain:
#
my $domain = $svc->domain(Net::DNS::Domain->new('example.com'));
#
# do a search:
#
my $result = $svc->domains('name' => 'ex*mple.com');
=head1 DESCRIPTION
While L<Net::RDAP> provides a unified interface to the universe of
RIR, domain registry, and domain registrar RDAP services,
L<Net::RDAP::Service> provides an interface to a specify RDAP service.
You can do direct lookup of objects using methods of the same name that
L<Net::RDAP> provides. In addition, this module allows you to perform
searches.
=head1 METHODS
=head2 Constructor
my $svc = Net::RDAP::Service->new($url);
Creates a new L<Net::RDAP::Service> object. C<$url> is a string or a
L<URI> object representing the base URL of the service.
You can also provide a second argument which should be an existing
L<Net::RDAP> instance. This is used when fetching resources from the
server.
=head2 Lookup Methods
You can do direct lookups of objects using the following methods:
=over
=item * C<domain()>
=item * C<ip()>
=item * C<autnum()>
=item * C<entity()>
=item * C<nameserver()>
=back
They all work the same way as the methods of the same name on
L<Net::RDAP>.
=head2 Search Methods
You can perform searches using the following methods. Note that
different services will support different search functions.
$result = $svc->domains(%QUERY);
$result = $svc->entities(%QUERY);
$result = $svc->nameservers(%QUERY);
In all cases, C<%QUERY> is a set of search parameters. Here are some
examples:
$result = $svc->domains('name' => 'ex*mple.com');
$result = $svc->entities('fn' => 'Ex*ample, Inc');
$result = $svc->nameservers('ip' => '192.168.0.1');
The following parameters can be specified:
=over
=item * domains: C<name> (domain name), C<nsLdhName> (nameserver
name), C<nsIp> (nameserver IP address)
=item * nameservers: C<name> (host name), C<ip> (IP address)
=item * entities: C<handle>, C<fn> (Formatted Name)
=back
Search parameters can contain the wildcard character "*" anywhere
in the string.
These methods all return L<Net::RDAP::SearchResult> objects.
=head1 COPYRIGHT
Copyright 2018 CentralNic Ltd. All rights reserved.
=head1 LICENSE
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of the author not be used
in advertising or publicity pertaining to distribution of the software
without specific prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
=cut
1;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment