Net::D...ranoid(3pm)

πŸ“¦
version 0.09 Β· 2 versions
, in fedora 43

πŸ’– Net::DNS::Paranoid β€” the manual, but make it cute πŸ’–

okay bestie, so this is a User Contributed Perl Documentation page, manual section 3pm, and the module is Net::DNS::Paranoid. buckle up, it's giving ✨paranoid✨ but in a good way 🫢


πŸŽ€ NAME πŸŽ€

Net::DNS::Paranoid β€” a paranoid dns resolver πŸ•΅οΈβ™€οΈπŸ’…


✨ SYNOPSIS ✨

my $dns = Net::DNS::Paranoid->new();
$dns->blocked_hosts([
    'mixi.jp',
    qr{\.dev\.example\.com$},
]);
$dns->whitelisted_hosts([
    'twitter.com',
]);
my ($addrs, $errmsg) = $dns->resolve('mixi.jp');
if ($addrs) {
    print @$addrs, $/;
} else {
    die $errmsg;
}

like. it's literally right there. copy it, bestie 🧚


🌸 DESCRIPTION 🌸

This is a wrapper module for Net::DNS. no cap.

And what does it do?? It detects IP address / host names for internal servers. that's the whole vibe. it's the friend who goes "girl, that address is giving internal, we're not going there" πŸ’€πŸš«


πŸ‘‘ METHODS πŸ‘‘

my $dns = Net::DNS::Paranoid->new(%args)

Create new instance with following parameters, bestie:

  • timeout β€” DNS lookup timeout, in secs. Default: 15 sec. so you got 15 seconds before it's like "okay I'm out" ⏰
  • blocked_hosts: ArrayRef[Str|RegExp|Code] β€” List of blocked hosts, and you can write them as a string, a regexp, or a coderef. choose your fighter πŸ₯Š
  • whitelisted_hosts: ArrayRef[Str|RegExp|Code] β€” List of white listed hosts, again as string, regexp or coderef. yes same three options, she's consistent πŸ’…
  • resolver: Net::DNS::Resolver β€” a DNS resolver object, and it has the same interface as Net::DNS::Resolver. drop yours in, she won't even notice πŸ¦‹

my ($addrs, $err) = $dns->resolve($name[, $start_time[, $timeout]])

Resolve a host name using DNS πŸŽ€. If it's a bad host, then it returns $addrs as undef, and $err is the reason in string. so like, it tells you why it's a no πŸ™ˆ

  • $start_time is a time to start your operation. The timeout value was counted from it. Default value is time(). ⏱️
  • $timeout is a timeout value. Default value is "$dns-"timeout>. yes that's literally what the original says, don't @ me 😭

πŸ”₯ USE WITH Furl πŸ”₯

You can use Net::DNS::Paranoid with Furl! obsessed, honestly.

use Furl::HTTP;
use Net::DNS::Paranoid;

my $resolver = Net::DNS::Paranoid->new();
my $furl = Furl->new(
    inet_aton => sub {
        my ($host, $errmsg) = $resolver->resolve($_[0], time(), $_[1]);
        die $errmsg unless $host;
        Socket::inet_aton($host->[0]);
    }
);

🌈 USE WITH LWP 🌈

I shipped LWPx::ParanoidHandler to wrap this module. Please use it. like, genuinely, please 🫢


πŸ’œ THANKS TO πŸ’œ

Most of the code was taken from LWPx::ParanoidAgent. giving credit where credit is due, periodt πŸ‘‘


⭐ AUTHOR ⭐

Tokuhiro Matsuno < tokuhirom @A gmail DOT. com> β€” icon, legend, the moment πŸ’–


πŸ“œ LICENSE πŸ“œ

Copyright (C) Tokuhiro Matsuno

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


fr fr, that's the whole page. no notes. slay πŸ’…βœ¨

and that's a wrap bestie β€” this was rendered from perl v5.42.0, dated 2025-07-25, and the page signs off as Net::D...ranoid(3pm) (yes the header truncates it, she's mysterious like that πŸ’€). bye, ily, go block some hosts πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from