> > I, being too lazy to look up a perl function, would use 
> hostname command in
> > backticks like so:
> > 
> > $HostID = `hostname`;
> > 
> 
> Right which is why the above is "too lazy". Anyone reading this please
> don't settle for the above, it is error prone, insecure, and
> insufficient. There is no error checking, there at least needs to be a
> full path, and it is potentially slower.

After the initial shock of having 1 simple assignment statement ripped to
shreds, I thought about it for a minute and it downed on me that I'm not
buying into your accusations. I would like you to please explain them. If
these are indeed realistic problems then everyone should know why. And
please don't use examples like, "it is insecure because someone could swap
out the hostname binary with something potentially damaging" because that
would require root access and for that matter a bang statement to the perl
binary would suffer from the same security flaws.
 
> > Not sure if that will catch a newline character so I would 
> also follow it
> > with this:
> > 
> > $HostID =~ s/\n//;
> 
> Right, in which case we can at least suggest 'chomp',

Matter of preference really. I like using regex.

> > 
> > -----Original Message-----
> > From: Bret Goodfellow [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, June 09, 2005 3:36 PM
> > To: beginners@perl.org
> > Subject: host id
> > 
> > 
> > Simple question to answer, I hope. I am running on an HP-UX 
> system, and
> > would like to retrive the UNIX system's host-id (name of 
> box). Is there
> > a function to do this?
> > 
> > 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to