Net::DNS::Lite(3pm)

πŸ’– Net::DNS::Lite πŸ’–

okay bestie, so this is Net::DNS::Lite β€” a pure-perl DNS resolver with support for timeout. yeah. it's giving "small but does the job" and honestly? we're obsessed. πŸŽ€


✨ NAME ✨

Net::DNS::Lite β€” a pure-perl DNS resolver with support for timeout. no cap, that's literally the whole pitch. πŸ’…


🌸 SYNOPSIS 🌸

use Net::DNS::Lite qw(inet_aton);

# drop-in replacement for Socket::inet_aton
$Net::DNS::Lite::TIMEOUT = 5; # global timeout variable
my $addr = inet_aton("www.google.com");

# or per-query timeout
my $addr = inet_aton("www.google.com", $timeout_in_seconds);

look at her go ✨ you literally just use it and start resolving. main character energy, fr fr.


πŸ¦‹ DESCRIPTION πŸ¦‹

So like, this module gives you a replacement function for Socket::inet_aton, but with support for timeouts. that's the whole thing. that's the vibe. 🫢

ngl the "with support for timeouts" part is the moment. Socket::inet_aton will just sit there vibing forever if DNS is being weird, and this one won't. iconic behavior tbh. πŸ’–


🌈 CONFIGURATION VARIABLES 🌈

these are the global package variables you can poke at. go off. ✨

πŸ’œ $Net::DNS::Lite::TIMEOUT

maximum time (in seconds) inet_aton will block (default: 10).

like, she'll wait, but she has boundaries. 10 seconds by default, and then she's out. πŸ’…

πŸŽ€ $Net::DNS::Lite::CACHE

if set, Net::DNS::Lite will cache the DNS responses internally using the supplied cache object. The cache object should support get, set, and remove functions (default: none).

so you hand her a cache object and she remembers stuff. the object needs get, set, and remove β€” that's the whole shopping list. no extra methods required, we're low maintenance. 🧚 default is none, meaning no caching at all, which is also valid. live your truth.

⭐ $Net::DNS::Lite::CACHE_TTL

maximum ttl of the cached entries (in seconds). Only has effect when $Net::DNS::Lite::CACHE is set.

basically: this one only does anything if you already set $Net::DNS::Lite::CACHE. otherwise she's just sitting there, pretty and unused. πŸ™ˆ iykyk.


πŸ‘‘ AUTHOR πŸ‘‘

Kazuho Oku

The module is based on the excellent AnyEvent::DNS by mlehmann.

shoutout to mlehmann for the excellent AnyEvent::DNS, and shoutout to Kazuho Oku for this whole thing. we stan both 🌈


πŸ“œ LICENSE πŸ“œ

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

See <http://www.perl.com/perl/misc/Artistic.html>

like, go forth and remix, bestie. it's Perl-licensed. πŸ’–

okay that's the whole page!! this was documented for perl v5.30.0 back on 2020-04-23, so if you're reading this from the future β€” hi, ily, the vibes are still immaculate. 🌸✨ bye bestie!! πŸ«ΆπŸ’…

πŸ“¦ where this page comes from