Net::Whois::RIPE3pm
Implementation of ripe whois.
Usage
use Net::Whois::RIPE;$whois = Net::Whois::RIPE->new($host);$whois = Net::Whois::RIPE->new($host,Timeout=>10);$whois = Net::Whois::RIPE->new($host,Timeout=>10,Port=>43);$whois->no_recursive;$whois->source('APNIC');$whois->type('inetnum');foreach $inet ($whois->query('203.203.203.203')) {print $inet->inetnum, "\n";}$whois->query('202.12.28.0');$whois->update($text);# to minimise memory requirements on large lookups...$iterator = $whois->query_iterator('DNS3-AP');while ($obj = $iterator->next) {...}$whois->template('inetnum');$whois->verbose_template('inetnum');$whois->debug(1);$whois->max_read_size(1024);$whois->search_all; # -a$whois->fast_raw; # -F$whois->find_less; # -L$whois->find_more; # -m$whois->find_all_more; # -M$whois->no_recursive; # -r$whois->no_referral; # -R$whois->no_sugar; # -S$whois->no_filtering; # -B$whois->no_grouping; # -G$whois->inverse_lookup($attribute); # -i $attribute$whois->source('APNIC'); # -s APNIC$whois->type('person'); # -T person# query only$whois->port();$whois->server();
Overview
Net::Whois::RIPE class implementing a RIPE whois client.
Constructor
- new (HOST [,OPTIONS])
-
This is the constructor for a new Net::Whois::RIPE object.
"HOST"is the name of the remote host to which a whois connection is required."OPTIONS"are passed in a hash like fashion, using key and value pairs. Possible options are:Port - The port number to connect to on the remote machineTimeout - Set a timeout value in seconds (defaults to 30)Debug - See debug methog.The constructor returns undef on failure. If
debugis on then a message is carped about the failure.
Methods
template(WHOIS_OBJECT_NAME)-
Sends a template request to whois host for a template of WHOIS_OBJECT_NAME. Results are returned in a Net::Whois::RIPE::Object object. The template is retrieved via the content method on the Net::Whois::RIPE::Object object.
$t = $whois->template('all');$t = $whois->template('inetnum');$t = $whois->template('person');$text = $t->content;If WHOIS_OBJECT_NAME is undefined then the method will carp (under debug) and return undef.
verbose_template(WHOIS_OBJECT_NAME)-
Like
template, but sends a verbose template request to the whois host for WHOIS_OBJECT_NAME. Results are returned in a Net::Whois::RIPE::Object object. The verbose template is retrieved via the content method on the Net::Whois::RIPE::Object object.$vt = $whois->verbose_template('person');$text = $vt->content;If WHOIS_OBJECT_NAME is undefined then the method will carp and return undef.
query(QUERY_TEXT)-
Formats query flag options (see below) and sends them and QUERY_TEXT to the server. If called in a scalar context then the first object returned from the server is passed back as a single Net::Whois::RIPE::Object object. In an array context, all returned objects returned from the server are parsed into in a list and returned (potentially quite large).
$q = $whois->query('key') # a single Query@q = $whois->query('key') # an array of QueriesIf QUERY_KEY is undefined, undef is returned. Any failure will carp and return undef.
If
max_read_sizeis greater than zero then the server response will be abandoned when greater than max_read_size bytes have been read. The last object read will have warning messages set to indicate that the response was cut.
query_iterator(QUERY_TEXT)-
Similar to query except that a Net::Whois::RIPE::Iterator object is returned. This object is used to iterate over the results of the query.
This was created in response to huge results returned by whois queries where over 1000 objects may be returned. Query iterator returns an object at a time via the next method as opposed to query which returns an array of objects.
$iterator = $whois->query_iteratoror die "unable to create iterator";while ($obj = $iterator->next) {...}
update(UPDATE_TEXT)-
Sends UPDATE_TEXT directly to server. Query flag options (below) are not used by update. Server response is returned via Net::Whois::RIPE::Object. Use the
contentmethod on the Query object to via server response.my $q = $whois->update($message)print $q->contentIf UPDATE_TEXT is undefined, undef is returned. Any failure will carp and return undef.
If no changed field can be found to determine a login and domain the method will carp and return undef.
If
max_read_sizeis greater than zero then the server response will be abandoned when greater than max_read_size bytes have been read.
debug(LEVEL)-
Sets/gets debugging level on the class or an object.
0 - no debugging1 - debugging on2 - carp on IO::Socket::INET
max_read_size([INTEGER])-
Sets/reads the maximum number of bytes that Net::Whois::RIPE will read before returning. This is to limit huge responses from the server overloading scripts.
a max_read_size of zero indicates
nolimit.
- flag options
-
The following flags may be set by calling the method. Their meaning is identical to the ripe whois client. These flags require no arguments, they simply set the flag on.
Method Equivalent whois flagsearch_all -afast_raw -Ffind_less -Lfind_more -mfind_all_more -Mno_recursive -rno_referral -Rno_sugar -Sno_filtering -Bno_grouping -G
- flag options taking values
-
The following flags may be set by calling the method with a value. There meaning is identical to the ripe whois client.
Method Equivalent whois flaginverse_lookup(ATTRIBUTE) -i ATTRIBUTEport(PORT) -p PORTsource(SOURCE) -s SOURCEtype(TYPE) -T TYPE
Todo
Update could be made clever enough to determine if it was been passed a string to update or a Net::Whois::RIPE::Object and adapt its behaviour.
Releases
5 releases since Debian 4.0 (Etch); the text changed 2 times.