Net::DNS is a better tool if resolving is causing a lot
of problems. It allows better user control over how the
resolver works.
If you're an admin on a UNIX-type system, you can tweak your resolver
to make it work better. The defaults are really lax and
can cause problems like you have encountered. As a bonus,
this will speed up everything on the system that uses DNS.
For Linux, BSD, and the like,
/etc/resolv.conf is used to control the behaviour
of the resolver. There are some parameters such as
timeout which can speed things up for failed
results, and you can use more than one DNS server using
the
rotate option.
More details at:
man resolv.conf