Net::W...Parser(3pm)
π Net::W...Parser β your fave whois whisperer π
okay so bestie, welcome to Net::W...Parser(3pm), one of the pages that lives under User Contributed Perl Documentation πΈ. It's the manual for Net::Whois::Parser and honestly? she eats. let's get into it π
β¨ NAME β¨
Net::Whois::Parser β a module for parsing whois information π¦
π SYNOPSIS π
okay so first things first, you pull her in:
use Net::Whois::Parser;
my $info = parse_whois( domain => $domain );
my $info = parse_whois( raw => $whois_raw_text, domain => $domain );
my $info = parse_whois( raw => $whois_raw_text, server => $whois_server );
$info = {
nameservers => [
{ domain => 'ns.example.com', ip => '123.123.123.123' },
{ domain => 'ns.example.com' },
],
emails => [ 'admin@example.com' ],
domain => 'example.com',
somefield1 => 'value',
somefield2 => [ 'value', 'value2' ],
...
};
like, that's the whole vibe β you feed her a domain or some raw text, she hands you back a lil hash full of goodies. nameservers? emails? domain? whatever the server decided to spill? all in there πβ¨
but WAIT, there's more, because you can also write your own parsers, and that's the part that's genuinely iconic:
# Your own parsers
sub my_parser {
my ( $text ) = @_;
return {
nameservers => [
{ domain => 'ns.example.com', ip => '123.123.123.123' },
{ domain => 'ns.example.com' },
],
emails => [ 'admin@example.com' ],
somefield => 'value',
somefield2 => [ 'value', 'value2' ],
};
}
$Net::Whois::Parser::PARSERS{'whois.example.com'} = \&my_parser;
$Net::Whois::Parser::PARSERS{'DEFAULT'} = \&my_default_parser;
yes bestie, you just drop your sub into %Net::Whois::Parser::PARSERS keyed by whois server, and if nobody matches, 'DEFAULT' catches it. main character energy fr fr π
and then there's the lil extras, the seasoning, if you will π:
# If you want to get all values of fields from all whois answers
$Net::Whois::Parser::GET_ALL_VALUES = 1;
# example
# Net::Whois::Raw returns 2 answers
$raw = [ { text => 'key: value1' }, { text => 'key: value2'}];
$data = parse_whois(raw => $raw);
# If flag is off parser returns
# { key => 'value2' };
# If flag is on parser returns
# { key => [ 'value1', 'value2' ] };
# If you want to convert some field name to another:
$Net::Whois::Parser::FIELD_NAME_CONV{'Domain name'} = 'domain';
# If you want to format some fields.
# I think it is very useful for dates.
$Net::Whois::Parser::HOOKS{'expiration_date'} = [ \&format_date ];
so $GET_ALL_VALUES decides whether repeated fields collapse down to the last one or pile up into a whole array, %FIELD_NAME_CONV renames fields for you, and %HOOKS lets you run your own formatting on a field β and yeah, dates are literally the perfect use case for that, no cap ποΈπ
π DESCRIPTION π
Net::Whois::Parser module provides Whois data parsing. You can add your own parsers for any whois server. π¦β¨
that's it, that's the pitch β she parses whois data, and she's endlessly extendable, so every server can have its own lil handler. obsessed π
π FUNCTIONS π
parse_whois(%args)
Returns hash of whois data. Arguments: π«
'domain'β domain'raw'β raw whois text'server'β whois server'which_whois'β option forNet::Whois::Raw::whois. Default value isQRY_ALL
π¦ CHANGES π¦
See file "Changes" in the distribution πβ¨
π«Ά AUTHOR π«Ά
Ivan Sokolov, "<ivsokolov@cpan.org>" β ty for your service king π
π COPYRIGHT & LICENSE π
Copyright 2009 Ivan Sokolov
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
and that's the whole page bestie, we're done!! this was perl v5.34.0, dated 2022-06-16, and the page you just read is Net::W...Parser(3pm). go forth and parse some whois, you're gonna slay πβ¨π¦πΈπ
π
π¦ where this page comes from
- debian bookworm: libnet-whois-parser-perl 0.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libnet-whois-parser-perl 0.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libnet-whois-parser-perl 0.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libnet-whois-parser-perl 0.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-whois-parser-perl 0.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms