|
NAMENet::Whois::Generic - a pure-Perl implementation of a multi source Whois client.SYNOPSISNet::Whois::Generic is my first attempt to unify Whois information from different sources. Historically Net::Whois::RIPE was the first written, then Net::Whois::Object was added to provide a RPSL encapsultation of the data returned from RIPE database, with an API more object oriented.Net::Whois::Generic is a new interface designed to be more generic and to encapsulate data from various sources (RIPE, but also AFRINIC, APNIC...) The current implementation is barely a proof of concept, AFRINIC and APNIC are the only other sources implemented, but I expect to turn it into a generic/robust implementation based on the users feedback. my $c = Net::Whois::Generic->new( disconnected => 1, unfiltered => 1 ); my ($org) = $c->query( 'ORG-AFNC1-AFRINIC', { type => 'organisation' } ); # $org is a 'Net::Whois::Object::Organisation::AFRINIC' object; my @o = $c->query('101.0.0.0/8'); # @o contains various Net::Whois::Object:Inetnum::APNIC, and Net::Whois::Object::Information objects As Net::Whois::Generic started as an improvment of Net::Whois::RIPE, and have a good amount of code in common, for this reason (and some others) it is currently bundled inside the the Net::Whois::RIPE package. This might change in the future although. METHODSnew( %options )Constructor. Returns a new Net::Whois::Generic object with an open connection to the RIPE Database service of choice (defaulting to "whois.ripe.net:43").The %options hash migth contain configuration options for the RIPE Database server. Not all options provided by the RIPE Database server are suitable for this implementation, but the idea is to provide everything someone can show a use for. The options currently recognized are:
hostname( [$hostname] )Accessor to the hostname. Accepts an optional hostname, always return the current hostname.port()Accessor to the port. Accepts an optional port, always return the current port.timeout()Accessor to the timeout configuration option. Accepts an optional timeout, always return the current timeout.referral()Accessor to the referral configuration option. Accepts an optional referral, always return the current referral.recursive()Accessor to the recursive configuration option. Accepts an optional recursive, always return the current recursive.grouping()Accessor to the grouping configuration option. Accepts an optional grouping, always return the current grouping.unfiltered()Accessor to the unfiltered configuration option.connect()Initiates a connection with the current object's configuration.ios()Accessor to the IO::Select object coordinating the I/O to the IO::Socket object used by this module to communicate with the RIPE Database Server. You shouldn't use this object, but the "send()" and "query( $query_string )" methods instead.socket()Read-only accessor to the IO::Socket object used by this module.send()Sends a message to the RIPE Database server instance to which we're connected to. Dies if it cannot write, or if there's no open connection to the server.Return "true" if the message could be written to the socket, "false" otherwise. reconnect()Reconnects to the server in case we lost connection.disconnect()Disconnects this client from the server. This renders the client useless until you call "connect()" again. This method is called by "DESTROY()" as part of an object's clean-up process.is_connected()Returns "true" if this instance is connected to the RIPE Database service configured.DESTROY()Net::Whois::Generic object destructor. Called by the Perl interpreter upon destruction of an instance._find_rir( $query_string )Guess the associated RIR based on the query.adapt_query( $query_string[, $rir] )Adapt a query to set various parameter (whois server, query options...) based on the query. Takes an optional parameter $rir, to force a specific RIR to be used.query( $query, [\%options] )******************************** EXPERIMENTAL ************************************ This method is a work in progress, the API and behaviour are subject to change ********************************************************************************** Query the the appropriate RIR database and return Net::Whois::Objects This method accepts 2 optional parameters 'type' which is a regex used to filter the query result: Only the object whose type matches the 'type' parameter are returned 'attribute' which is a regex used to filter the query result: Only the value of the attributes matching the 'attribute' parameter are returned Note that if 'attribute' is specified strings are returned, instead of Net::Whois::Objects Net::Whois:Generic->query() deprecates Net::Whois::Object->query() since release 2.005 of Net::Whois::RIPE 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. _process_response( $response )Process a response (error code, error message...)AUTHORArnaud "Arhuman" Assad, "<arhuman at gmail.com>"CAVEATS
BUGSPlease report any bugs or feature requests to "bug-net-whois-ripe at rt.cpan.org", or through the web interface at <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.SEE ALSOThere are several tools similar to Net::Whois::Generic, I'll list some of them below and some reasons why Net::Whois::Generic exists anyway:Net::Whois::IANA - A universal WHOIS extractor: update not possible, no RPSL parser Net::Whois::ARIN - ARIN whois client: update not possible, only subset of ARIN objects handled Net::Whois::Parser - Module for parsing whois information: no query handling, parser can (must?) be added Net::Whois::RIPE - RIPE whois client: the basis for Net::Whois::Generic but only handle RIPE. SUPPORTYou can find documentation for this module with the perldoc command.perldoc Net::Whois::Generic You can also look for information at:
ACKNOWLEDGEMENTSThanks to Jaguar Networks which grants me time to work on this module.COPYRIGHT & LICENSECopyright 2013 Arnaud "Arhuman" Assad, all rights reserved.This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |