Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://753850]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2018-02-23 12:53 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (302 votes). Check out past polls.