Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: gethostbyname() problem

by frieduck (Hermit)
on Mar 28, 2009 at 13:52 UTC ( #753850=note: print w/ replies, xml ) Need Help??

in reply to gethostbyname() problem

As ikegami has pointed out, your system name resolution isn't doing what you want, so Perl won't either, as it uses the same underlying libraries to do so.

On many/most *nix systems, name resolution is controlled by entries in /etc/nsswitch.conf. You'll find a line there for "hosts" that will control where your system looks to resolve names, and in what order it does. For your system to look at /etc/hosts first, you'll want your file to have a line that looks like:

hosts: files dns
This line essentially says, "look at /etc/hosts, and if you don't find it there, use DNS".

If your /etc/nsswitch.conf file looks right, your /etc/hosts may have other issues that prevent that line from matching.

Comment on Re: gethostbyname() problem
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://753850]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2015-11-26 23:16 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (709 votes), past polls