[ic] Mike H, one step at a time

Steffen Dettmer interchange-users@interchange.redhat.com
Wed Mar 20 03:38:01 2002


* Paul Jordan wrote on Tue, Mar 19, 2002 at 20:23 -0800:
> >         my $docroot = $opt->{document_root} || $::Variable->{DOCROOT};
> >         my $server  = $opt->{server}   || $::Variable->{SERVER_NAME};
> 
> Well, When I restarted interchange, I got some barewords errors, See I
> substituted www.imagemogul.com for SERVER_NAME. 

Try $::Variable->{'SERVER_NAME'}; SERVER_NAME is a string used as
key in a hashmap and here it seems to be undefined, and Perl
doesn't know if you mean a sub function or a string or what,
since it's just a bare word. Quoting is the correct usage of strings
always, but if SERVER_NAME if undefined, $server is undefined. You
should catch this I think, maybe:

my $server  = $opt->{'server'} 
	|| $::Variable->{'SERVER_NAME'}
	|| $fallback_servername
	|| "localhost";

or whatever. The "|| - until defined or set" construction works
here pretty well, but don't use it for numbers, just BTW :)
		
> barewords errors pointed me to the server name. SO I thought I could use my
> IP address for SERVER_NAME.

Hum, ugly I think, I don't like "names" in dotted-quad
notation...

> My question is, since this is my first tweaking on the server level, Is it
> OK to sub the IP address in there? Am I doing something that is bad
> practice?

"bad practice" is a nice desciption for that I think.

oki,

Steffen

-- 
Dieses Schreiben wurde maschinell erstellt,
es trägt daher weder Unterschrift noch Siegel.