Net-Whois-RIPE
view release on metacpan or search on metacpan
lib/Net/Whois/RIPE.pm view on Meta::CPAN
=head2 B<DESTROY()>
Net::Whois::RIPE object destructor. Called by the Perl interpreter upon
destruction of an instance.
=cut
sub DESTROY {
my $self = shift;
$self->disconnect;
}
=head2 B<query( $query_string )>
Sends a query to the server. Returns an L<Iterator> object that will return one RPSL block at a time.
=cut
# TODO: Identify and ignore comments within the Iterator scope?
# TODO: Identify and rise as soon as possible "%ERROR:\d+:.+" results.
sub query {
my ( $self, $query ) = @_;
my $parameters = "";
$parameters .= q{ } . QUERY_KEEPALIVE if $self->keepalive;
$parameters .= q{ } . QUERY_UNFILTERED if $self->unfiltered;
$parameters .= q{ } . QUERY_NON_RECURSIVE unless $self->recursive;
$parameters .= q{ } . QUERY_REFERRAL if $self->referral;
my $fullquery = $parameters . $query;
return $self->__query($fullquery);
}
# Allows me to pass in queries without having all the automatic options added
# up to it.
sub __query {
my ( $self, $query ) = @_;
$self->reconnect unless $self->keepalive;
die "Not connected" unless $self->is_connected;
if ( $self->ios->can_write( SOON + $self->timeout ) ) {
$self->socket->print( $query, EOL );
return Iterator->new(
sub {
local $/ = "\n\n";
if ( $self->ios->can_read( SOON + $self->timeout ) ) {
my $block = $self->socket->getline;
return $block if defined $block;
}
Iterator::is_done;
}
);
}
}
=head2 B<object_types()>
Return a list of known object types from the RIPE Database.
RIPE currently returns 21 types (Limerik have been removed):
as-block as-set aut-num domain filter-set inet6num inetnum inet-rtr irt
key-cert mntner organisation peering-set person poem poetic-form role route
route6 route-set rtr-set
Due to some strange mis-behaviour in the protocol (or documentation?) the RIPE
Database server won't allow a keep-alive token with this query, meaning the
connection will be terminated after this query.
=cut
sub object_types {
my $self = shift;
my $iterator = $self->__query(QUERY_LIST_OBJECTS);
while ( !$iterator->is_exhausted ) {
my $value = $iterator->value;
return split /\s+/, $value if $value !~ /^%\s/;
}
return;
}
=head1 CAVEATS
=over 4
=item B<No IPv6 Support>
There's no support for IPv6 still on this module. I'm planning to add it in a
future version.
=item B<Tests Depend On Connectivity>
As this is the initial alpha release, there is still some work to do in terms
of testing. One of the first things I must work on is to eliminate the
dependency on connectivity to the RIPE Database.
=item B<Current Interface is not Backwards-Compatible>
I plan to implement a drop-in replacement to the old interface soon, as an extension to this module. For now, this module just breaks compatibility with the old interface. Please read the full discussion about compatibility with older version of the ...
=back
=head1 BUGS
Please report any bugs or feature requests to C<bug-net-whois-ripe at
rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=net-whois-ripe>. I will be
notified, and then you'll automatically be notified of progress on your bug as
I make changes.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Net::Whois::RIPE
You can also look for information at:
=over 4
( run in 1.776 second using v1.01-cache-2.11-cpan-f56aa216473 )