On Fri, 28 Nov 2003, Louis wrote:

> My objective is to get a Perl command line script get this for a domain.
> That's why I was trying some Net modules. Via browser the script gets it
> easy from the ENV%.

You are referring to %ENV, I presume.

The environment inside the web server is the CGI environment,
which is *VERY* different from the environment in the shell.

In the shell, type: 

   set

The above will list all of the available env variables.
Perhaps you can pick on from the list variables that gives you
the hostname that you want.

Also: write a script for your web server to dump the CGI environment
to the browser.  You will note that the environment is COMPLETELY
different from the shell.

You refer to a script running in the browser. This is not what is
happening. The scripts you write run on the server, and the script
returns CONTENT to the browser.

Perhaps a visit to http://hotwired.lycos.com/webmonkey/ will clear
up any misunderstandings you might have with web serving, the web
client-server model and CGI scripting.

Good luck!


cheers
rickw

P.S. here is a really simple script in perl that will dump the CGI environment
to the web browser:

    print "Content-type: text/plain\r\n\r\n"
        .join("\n",map {"$_=$ENV{$_}"} sort keys %ENV)
        ."\n";



---------------------------------------------
Rick Welykochy || Praxis Services Pty Limited

"To mess up a Linux box, you need to work at it;
 to mess up your Windows box, you just need to work on it."
     -- Scott Granneman, SecurityFocus

-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to