develooper Front page | perl.perl5.porters | Postings from February 2000

Re: fixing Sys::Hostname

Thread Previous | Thread Next
Nick Ing-Simmons
February 8, 2000 07:48
Re: fixing Sys::Hostname
Message ID:
Tom Christiansen <> writes:
>>  ($host) = gethostbyname('localhost');
>>Sadly most UNIX boxes don't add a sane alias to their /etc/hosts file
>>so that trick is not portable.
>    % grep localhost /etc/hosts
>	localhost	

Which is exactly my point ;-)  there is no alias there, just the one name
and that makes 'localhost' the official name of the address.

If I do gethostbyname('localhost') on such a machine I get 'localhost'
back. But I would "like" to get back "pluto" or ""

Thus my entry "should" be : pluto localhost	

and yours "should" be : chthon localhost	

Nick Ing-Simmons <>
Via, but not speaking for: Texas Instruments Ltd.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About