Net::DN...r::Mock(3)

✨ NAME ✨

okay bestie, welcome to Net::DN...r::Mock(3) β€” the User Contributed Perl Documentation page that's literally all about Net::DNS::Resolver::Mock β€” mock a DNS Resolver object for testing. That's the vibe: a resolver object that's faking it for your tests, and honestly? iconic πŸ’…βœ¨


🌸 DESCRIPTION 🌸

This is a subclass of Net::DNS::Resolver which parses a zonefile for its data source. Primarily for use in testing. That's the whole main-character move: zonefile in, test-friendly resolver energy out πŸ¦‹πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

Here's the group-chat demo, bestie β€” pick your fave: read a file, or parse a string. Both are below, no cap ✨

use Net::DNS::Resolver::Mock;

my $Resolver = Net::DNS::Resolver::Mock-new();

$Resolver->zonefile_read( $FileName );
# or
$Resolver->zonefile_parse( $String );
yes, that dash in Net::DNS::Resolver::Mock-new(); is exactly what the page says β€” I'm just transcribing, don't come for me πŸ™ˆ

πŸ’… PUBLIC METHODS πŸ’…

zonefile_read ( $FileName )

Reads specified file for zone data. File name goes in, zone data comes out β€” slay πŸ“

zonefile_parse ( $String )

Reads the zone data from the supplied string. String-based zone data? Obsessed, honestly πŸ’œ

die_on ( $Name, $Type, $Error )

Die with $Error for a query of $Name and $Type. Very dramatic, very on-brand πŸ’€

enable_debug ()

Once set, the resolver will write any lookups received to STDERR and will be available via the following methods. Debug mode: activated πŸ”₯

disble_debug ()

Disable debugging. Yep, it's spelled disble_debug on the page β€” we preserve the vibe, periodt πŸ’…

clear_debug ()

Clear the debugging list. Fresh start energy ✨

get_debug ()

Returns a list of debugging entries. Gimme the receipts πŸ‘‘


🧚 DEPENDENCIES 🧚

  • Net::DNS::Resolver
  • Net::DNS::Packet
  • Net::DNS::Question
  • Net::DNS::ZoneFile

πŸ’€ BUGS πŸ’€

Please report bugs via the github tracker.

https://github.com/marcbradshaw/Net-DNS-Resolver-Mock/issues


🫢 AUTHORS 🫢

Marc Bradshaw, <marc@marcbradshaw.net> β€” shoutout to the author, fr fr 🫢


Copyright (c) 2017, Marc Bradshaw.


🌈 LICENCE 🌈

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


okay that's the whole page, bestie. cute sign-off vibes: perl v5.42.0, dated 2023-02-17, and it's literally Net::DN...r::Mock(3) β€” periodt. πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from