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

Re: fixing Sys::Hostname

Ilya Zakharevich
February 7, 2000 19:11
Re: fixing Sys::Hostname
Message ID:
On Mon, Feb 07, 2000 at 05:38:11PM -0800, Chip Salzenberg wrote:
> According to Tom Christiansen:
> > This "most systems in existence" line is a red herring.
> > *MOST* systems in existence are useless.
> True.  And Perl has never limited itself to the universally available
> set of OS features, anyway.

We should not restrict ourselves.  The question is: do we want "just
call C's gethostname() and accept the answer given" (why not use 

  $name = time;

instead, it has quite comparable rate of success ;-), or do we need
more probing than that - thus freeing the *user* of the interface from
doing more work.

Do we want probing sanity of gethostname() at compile time (trying to
connect to the returned name?), or at run time?  I would prefer
compile-time, with a flag to specify which may postpone this until the
run time.  Hmm, maybe just code two Perl functions: one with probing,
another without, and the third one which would switch between these
two basing on %Config data.

More questions to answer: if everything else fails, is 'localhost' a
good enough answer?  What if loopback is not set?

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