On Mon, 13 May 2013 08:53:13 -0700
Noah <[email protected]> wrote:
> Hi list,
>
>
> When Net::DNS resolved name is not found my script dies. How can I
> allow for my script to continue on even if there is a failed DNS
> query?
The usual way to catch exceptions is with an eval block or Try::Tiny
etc.
Basic example:
my $source_address = eval { $res->query(....); };
if ($@) {
# an error occurred - $@ will contain the message
# do something appropriate here
}
However, $resolver->query() should, according to the docs, just return
undef if no answers are found, and your example output suggests that
execution gets to your "query failed:" warning in the else block, so
something else is happening after that - something which we have no
idea, since we're not seeing the whole code.
--
David Precious ("bigpresh") <[email protected]>
http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan www.preshweb.co.uk/github
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/