NAME
Net::Whois::RegistryFusion - perform cacheable whois lookups using RegistryFusion XML API
SYNOPSIS
$rf = Net::Whois::RegistryFusion->new();
# OR:
$rf = Net::Whois::RegistryFusion->new({ refreshCache=>1,
AUTH=>'http://hexillion.com/rf/xml/1.0/auth/',
WHOIS=>'http://hexillion.com/rf/xml/1.0/whois/'
});
$rf->isCached('domain.com')
&&
$xml = $rf->whois('domain.com');
DESCRIPTION
This class does not do any XML parsing. You must create a subclass inheriting and extending the whois method where you can code the XML parsing using eg. XML::Simple. You must also implement the _getUsername, _getPassword, _getXmlpath methods.
The class does some basic on-disk caching of the raw xml retrieved from RegistryFusion. The path to the cache is specified using _getXmlpath method.
REQUIRED MODULES
Date::Format (any)
Error (any)
File::Slurp (any)
File::stat (any)
IO::LockedFile (any)
LWP::Simple (any)
Module::Signature (any)
Set::Array (any)
Test::More (any)
Test::Signature (any)
ABSTRACT METHODS
_getUsername
Must be implemented to return a RegistryFusion username
_getPassword
Must be implemented to return a RegistryFusion password
_getXmlpath
Must be implemented to return a path where XML cache files will be stored
PUBLIC METHODS
new
This is the constructor. It takes as argument a hashref of options.
One option is 'refreshCache'. Setting 'refreshCache' to a value of 1 will alter the behaviour of the whois method for the lifetime of the object; foregoing and deleting the cached domain (if any) and retrieving directly from RegistryFusion.
You can also pass the auth url in the 'AUTH' key and the whois url in 'WHOIS' key, overriding the default values of: AUTH => 'http://whois.RegistryFusion.com/rf/xml/1.0/auth/'; WHOIS => 'http://whois.RegistryFusion.com/rf/xml/1.0/whois/';
whois ($domain)
Returns (scalar) whois info in xml format for given $domain. Checks the cache first. If not found in the cache, retrieves from RegistryFusion. The whois xml info is cached in a file under the path as returned by _getXmlpath method. So, if the XMLPATH is '/registryfusion' and the $domain is 'example.com', the file will be stored as '/registryfusion/e/example.com.xml'
getFetchedDomains
Fetched domains are those domains that had the whois info fetched from RegistryFusion and not the cache. Accessor returns array in list context or a Set::Array object in scalar context.
isCached ($domain)
Returns TRUE if given domain is cached. FALSE otherwise.
deleteFromCache ($domain)
Deletes the given $domain from the cache.
logout
Logs out of RegistryFusion, expiring the session. This method is called by the destructor, so you don't need to explicitly call it.
getSessionKey
returns session key.
PRIVATE METHODS
_login
Login to RegistryFusion and return a session key. this method is called by the constructor.
TODO
Need generic test suite. eg. use Class::Generate to generate a subclass. Get the username, password, xmlpath values from user during make test.
I've started doing this but encountered a problem with the fact that the username, password and xmlpath variables are static class variables and Class::Generate doesn't take care of this. Maybe we can improve Class::Generate.
My current progress can be seen embedded in the pod (Test::Inline style).
AUTHOR
Ilia Lobsanov
COPYRIGHT AND LICENSE
Copyright (C) 2004 by Ilia Lobsanov
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.