{
    "mode": "perldoc",
    "parameter": "Net::XWhois",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Net%3A%3AXWhois/json",
    "generated": "2026-06-10T16:24:14Z",
    "synopsis": "use Net::XWhois;\n$whois = new Net::XWhois Domain => \"vipul.net\" ;\n$whois = new Net::XWhois Domain => \"bit.ch\",\nServer => \"domreg.nic.ch\",\nRetain => 1,\nParser => {\nnameservers => 'nserver:\\s+(\\S+)',\n};",
    "sections": {
        "NAME": {
            "content": "Net::XWhois - Whois Client Interface for Perl5.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Net::XWhois;\n\n$whois = new Net::XWhois Domain => \"vipul.net\" ;\n$whois = new Net::XWhois Domain => \"bit.ch\",\nServer => \"domreg.nic.ch\",\nRetain => 1,\nParser => {\nnameservers => 'nserver:\\s+(\\S+)',\n};\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The Net::XWhois class provides a generic client framework for doing Whois queries and parsing\nserver response.\n\nThe class maintains an array of top level domains and whois servers associated with them. This\nallows the class to transparently serve requests for different tlds, selecting servers\nappropriate for the tld. The server details are, therefore, hidden from the user and \"vipul.net\"\n(from InterNIC), gov.ru (from RIPE) and \"bit.ch\" (from domreg.nic.ch) are queried in the same\nmanner. This behaviour can be overridden by specifying different bindings at object construction\nor by registering associations with the class. See \"registerassociations()\" and \"new()\".\n\nOne of the more important goals of this module is to enable the design of consistent and\npredictable interfaces to incompatible whois response formats. The Whois RFC (954) does not\ndefine a template for presenting server data; consequently there is a large variation in layout\nstyles as well as content served across servers.\n\n(There is, however, a new standard called RPSL (RFC2622) used by RIPE (http://www.ripe.net), the\nEuropean main whois server.)\n\nTo overcome this, Net::XWhois maintains another set of tables - parsing rulesets - for a few,\npopular response formats. (See \"%PARSERS\"). These parsing tables contain section names (labels)\ntogether with regular expressions that *match* the corresponding section text. The section text\nis accessed \"via\" labels which are available as data instance methods at runtime. By following a\nconsistent nomenclature for labels, semantically related information encoded in different\nformats can be accessed with the same methods.\n",
            "subsections": []
        },
        "CONSTRUCTOR": {
            "content": "new ()\nCreates a Net::XWhois object. Takes an optional argument, a hash, that specifies the domain\nname to be queried. Calls lookup() if a name is provided. The argument hash can also specify\na whois server, a parsing rule-set or a parsing rule-set format. (See \"personality()\").\nOmitting the argument will create an \"empty\" object that can be used for accessing class\ndata.\n\npersonality ()\nAlters an object's personality. Takes a hash with following arguments. (Note: These\narguments can also be passed to the constructor).\n\nDomain  Domain name to be queried.\n\nServer  Server to query.\n\nParser  Parsing Rule-set. See \"%PARSERS\".\n\nParser => {\nname            => 'domain:\\s+(\\S+)\\n',\nnameservers     => 'nserver:\\s+(\\S+)',\ncontactemails  => 'e-mail:\\s+(\\S+\\@\\S+)',\n};\n\nFormat  A pre-defined parser format like INTERNIC, INTERNICFORMAT, RIPE, RIPECH, JAPAN\netc.\n\nFormat => 'INTERNICCONTACT',\n\nNocache Force XWhois to ignore the cached records.\n\nError   Determines how a network connection error is handled. By default Net::XWhois will\ncroak() if it can't connect to the whois server. The Error attribute specifies a\nfunction call name that will be invoked when a network connection error occurs.\nPossible values are croak, carp, confess (imported from Carp.pm) and ignore (a blank\nfunction provided by Net::XWhois). You can, of course, write your own function to do\nerror handling, in which case you'd have to provide a fully qualified function name.\nExample: main::logerr.\n\nTimeout Timeout value for establishing a network connection with the server. The default\nvalue is 60 seconds.\n\nCLASS DATA & ACCESS METHODS\n%PARSERS\nAn associative array that contains parsing rule-sets for various response formats. Keys of\nthis array are format names and values are hash refs that contain section labels and\ncorresponding parser code. The parser code can either be a regex or a reference to a\nsubroutine. In the case of a subroutine, the whois 'response' information is available to\nthe sub in $[0]. Parsers can be added and extended with the registerparser() method. Also\nsee \"Data Instance Methods\".\n\nmy %PARSERS  = (\nINTERNIC => {\ncontacttech    => 'Technical Contact.*?\\n(.*?)(?=\\...\ncontactzone    => 'Zone Contact.*?\\n(.*?)(?=\\s*\\n[...\ncontactbilling => 'Billing Contact.*?\\n(.*?)(?=\\s*...\ncontactemails  => \\&exampleemailparser\n},\n{ etc. ... },\n);\n\nsub exampleemailparser {\n\n# Note that the default internal implemenation for\n# the INTERNIC parser is not a user-supplied code\n# block.  This is just an instructive example.\n\nmy @matches = $[0] =~ /(\\S+\\@\\S+)/sg;\nreturn @matches;\n}\n\nSee XWhois.pm for the complete definition of %PARSERS.\n\n%WHOISPARSER\n%WHOISPARSER is a table that associates each whois server with their output format.\n\nmy %WHOISPARSER = (\n'whois.ripe.net'       => 'RPSL',\n'whois.nic.mil'        => 'INTERNIC',\n'whois.nic.ad.jp'      => 'JAPAN',\n'whois.domainz.net.nz' => 'GENERIC',\n'whois.nic.gov'        => 'INTERNIC',\n'whois.nic.ch'         => 'RIPECH',\n'whois.twnic.net'      => 'TAIWAN',\n'whois.internic.net'   => 'INTERNIC',\n'whois.nic.net.sg'     => 'RIPE',\n'whois.aunic.net'      => 'RIPE',\n'whois.cdnnet.ca'      => 'CANADA',\n'whois.nic.uk'         => 'INTERNIC',\n'whois.krnic.net'      => 'KOREA',\n'whois.isi.edu'        => 'INTERNIC',\n'whois.norid.no'       => 'RPSL',\n( etc.....)\n\nPlease note that there is a plethora of output formats, allthough there are RFCs on this\nissue, like for instance RFC2622, there are numerous different formats being used!\n\n%DOMAINASSOC\n%DOMAINASSOC is a table that associates top level domain names with their respective whois\nservers. You'd need to modity this table if you wish to extend the module's functionality to\nhandle a new set of domain names. Or alter existing information. *registerassociation()*\nprovides an interface to this array. See XWhois.pm for the complete definition.\n\nmy %DOMAINASSOC = (\n'al' => 'whois.ripe.net',\n'am' => 'whois.ripe.net',\n'at' => 'whois.ripe.net',\n'au' => 'whois.aunic.net',\n'az' => 'whois.ripe.net',\n'ba' => 'whois.ripe.net',\n'be' => 'whois.ripe.net',\n",
            "subsections": [
                {
                    "name": "register_parser",
                    "content": "Extend, modify and override entries in %PARSERS. Accepts a hash with three keys - Name,\nRetain and Parser. If the format definition for the specified format exists and the Retain\nkey holds a true value, the keys from the specified Parser are added to the existing\ndefinition. A new definition is created when Retain is false/not specified.\n\nmy $w = new Net::Whois;\n$w->registerparser (\nName   => \"INTERNIC\",\nRetain => 1,\nParser => {\ncreationtime => 'created on (\\S*?)\\.\\n',\nsomerandomeentity => \\&randomentitysubroutine\n};\n\nInstructions on how to create a workable randomentitysubroutine are availabe in the\n*%PARSERS* description, above.\n"
                },
                {
                    "name": "register_association",
                    "content": "Override and add entries to %ASSOC. Accepts a hash that contains representation specs for a\nwhois server. The keys of this hash are server machine names and values are list-refs to the\nassociated response formats and the top-level domains handled by the servers. See\nNet/XWhois.pm for more details.\n\nmy $w = new Net::XWhois;\n$w->registerassociation (\n'whois.aunic.net' => [ RIPE, [ qw/au/ ] ]\n);\n"
                },
                {
                    "name": "register_cache",
                    "content": "By default, Net::XWhois caches all whois responses and commits them, as separate files, to\n/tmp/whois. registercache () gets and sets the cache directory. Setting to \"undef\" will\ndisable caching.\n\n$w->registercache ( \"/some/place/else\" );\n$w->registercache ( undef );\n"
                }
            ]
        },
        "OBJECT METHODS": {
            "content": "Data Instance Methods\nAccess to the whois response data is provided via AUTOLOADED methods specified in the\nParser. The methods return scalar or list data depending on the context.\n\nInternic Parser provides the following methods:\n\nname()  Domain name.\n\nstatus()\nDomain Status when provided. When the domain is on hold, this method will return \"On\nHold\" string.\n\nnameservers()\nNameservers along with their IPs.\n\nregistrant\nRegistrant's name and address.\n\ncontactadmin()\nAdministrative Contact.\n\ncontacttech()\nTechnical Contact.\n\ncontactzone()\nZone Contact.\n\ncontactbilling()\nBilling Contact.\n\ncontactemails()\nList of email addresses of contacts.\n\ncontacthandles()\nList of contact handles in the response. Contact and Domain handles are valid query\ndata that can be used instead of contact and domain names.\n\ndomainhandles()\nList of domain handles in the response. Can be used for sorting out reponses that\ncontain multiple domain names.\n",
            "subsections": [
                {
                    "name": "lookup",
                    "content": "Does a whois lookup on the specified domain. Takes the same arguments as new().\n\nmy $w = new Net::XWhois;\n$w->lookup ( Domain => \"perl.com\" );\nprint $w->response ();\n"
                }
            ]
        },
        "EXAMPLES": {
            "content": "Look at example programs that come with this package. \"whois\" is a replacement for the standard\nRIPE/InterNIC whois client. \"creation\" overrides the Parser value at object init and gets the\nCreation Time of an InterNIC domain. \"creation2\" does the same thing by extending the Class\nParser. \"contacts\" queries and prints information about domain's Tech/Billing/Admin contacts.\n\ncontribs/ containts parsers for serveral whois servers, which have not been patched into the\nmodule.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Vipul Ved Prakash <mail@vipul.net>\n",
            "subsections": []
        },
        "THANKS": {
            "content": "Curt Powell <curt.powell@sierraridge.com>, Matt Spiers <matt@pavilion.net>, Richard Dice\n<rdice@pobox.com>, Robert Chalmers <robert@chalmers.com.au>, Steinar Overbeck Cook\n<steinar@balder.no>, Steve Weathers <steve@domainit.com>, Robert Puettmann <rpuettmann@ipm.net>,\nMartin H . Sluka\" <martin@sluka.de>, Rob Woodard <rwoodard15@attbi.com>, Jon Gilbert, Erik\nAronesty for patches, bug-reports and many cogent suggestions.\n",
            "subsections": []
        },
        "MAILING LIST": {
            "content": "Net::XWhois development has moved to the sourceforge mailing list,\nxwhois-devel@lists.sourceforge.net. Please send all Net::XWhois related communication directly\nto the list address. The subscription interface is at:\nhttp://lists.sourceforge.net/mailman/listinfo/xwhois-devel\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "RFC 954  <http://www.faqs.org/rfcs/rfc954.html>\nRFC 2622 <http://www.faqs.org/rfcs/rfc2622.html>\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright (c) 1998-2001 Vipul Ved Prakash. All rights reserved. This program is free software;\nyou can redistribute it and/or modify it under the same terms as Perl itself.\n",
            "subsections": []
        }
    },
    "summary": "Net::XWhois - Whois Client Interface for Perl5.",
    "flags": [],
    "examples": [
        "Look at example programs that come with this package. \"whois\" is a replacement for the standard",
        "RIPE/InterNIC whois client. \"creation\" overrides the Parser value at object init and gets the",
        "Creation Time of an InterNIC domain. \"creation2\" does the same thing by extending the Class",
        "Parser. \"contacts\" queries and prints information about domain's Tech/Billing/Admin contacts.",
        "contribs/ containts parsers for serveral whois servers, which have not been patched into the",
        "module."
    ],
    "see_also": []
}