use Net::DNS::Resolver::Recurse;
my $resolver = new Net::DNS::Resolver::Recurse();
$resolver->debug(1);
$resolver->hints('198.41.0.4'); # A.ROOT-SERVER.NET.
my $packet = $resolver->send( 'www.rob.com.au.', 'A' );
$resolver->hints(@ip);
If no hints are passed, the priming query is directed to nameservers drawn from a built-in list of IP addresses.
$packet = $resolver->send( 'www.example.com.', 'A' );
Server-side recursion is suppressed by clearing the recurse flag in query packets and recursive name resolution is performed explicitly.
The query() and search() methods are inherited from Net::DNS::Resolver and invoke send() indirectly.
For example to emulate dig's "+trace" function:
my $coderef = sub {
my $packet = shift;
printf ";; Received %d bytes from %s\n\n",
$packet->answersize, $packet->answerfrom;
};
$resolver->callback($coderef);
The callback subroutine is not called for queries for missing glue records.
Portions Copyright (c)2002 Rob Brown.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.