Surely, if you have control of your directory structure, you can use
$ENV{DOCUMENT_ROOT}. There is no absolutely general solution, and you must
be aware of what virtual hosting may do to your path.
- Roger -
----- Original Message -----
From: "Robert Bunn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 27, 2001 10:10 AM
Subject: directory listing of document root?


> Hi, listizens.
>
> I've been trying to build an automated web site, where sections of the
site
> are subdirectories of the document root. What I'm looking for is a way,
> preferably easy and convenient, for a cgi script residing in
> /arbitrary/cgi/directory to get a directory listing of
> /other_arbitrary/webserver/document/root. If I
>
> opendir(DIR,"\/");
>
> I get the *system* root directory, which is undesirable. I *could*
hardcode
> the full path of the document root according to the system, and this would
> work, but it would be a) inelegant and 2) not easily portable, both of
> which make it suboptimal in my opinion. I could use the path "../htdocs/"
> which would work on most default installations of apache, but I would
> prefer a guaranteed completely portable method because I may have to use
> the script on a MS IIS installation and would prefer to minimize the
> rewriting necessary for that.
>
> I've looked through the docs on perldoc.com for the CGI module, and they
> suggest no solution to me. (path_translated() gives me the path to the
> script, not to the document root.) Any suggestions?
>
> --
> Robert Bunn
> JAPN
>
>


----------------------------------------------------------------------------
----


> ____________________________________________________________
> This messsage was sent using the trial version of the
> 1st Class Mail Server software.
>
> The 1st Class Mail Server 3.0 has lots of cool new features.
> Best of all, it's still free! To download the latest version,
> go to http://www.1cis.com/download/1cismail.asp
>
>


----------------------------------------------------------------------------
----


> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to