UBB.Dev
Posted By: pangngan about use Cwd and getcwd in Perl - 07/11/2002 4:35 AM
Hi,
This is a more concise version of a question that I posted on the new members forum .

I ran the following lt_test.cgi from the cgi-bin of the Windows 2000 Professional Default Website.
[code][/code]In the require statement above, I needed to use an absolute path for require to be able to "get" vars_config.cgi

Before the require statement used above I had hoped to be able to run the following:-

print "Content-type: text/htmlnn";
use Cwd;
$dir = getcwd;
print "$dir";

What $dir returned was a physical path to which the Default Website was mapped to. ("C:/Sites_04july2002_1/Sitename/community/boards")

I had hoped that $dir would return the total physical path all the way path to the cgi-bin (since I was running lt_test.cgi from the cgi-bin itself).

If that was possible I could do

require "$dir/vars_config.cgi"

Is there a way to do this?

Would appreciate any help:)
Posted By: Idle Re: about use Cwd and getcwd in Perl - 07/11/2002 12:54 PM
Try $dir = cwd(); instead.
Posted By: pangngan Re: about use Cwd and getcwd in Perl - 07/11/2002 5:30 PM
10:53pm at night
ah . .what an encouragement to get a response smile
cwd returned the same result as getcwd . .

however the good news is after reading the reply a random thought
from having read snippets of tcl/tk articles on using environmental variables prompted a
Google search for "using perl to access IIS environment variables"

Bingo! search result no.2

http://sislands.com/coin70/week6/envars.htm

$dir= $ENV{'PATH_TRANSLATED'}
kinda gives me what I need
[code][/code]
output
C:Sites_04july2002_1Sitenamecommunityboardscgi-binlt_test.cgi


now the next question is how to extract into a single variable the part of the pathname that goes all the way until the last ""

would appreciate any help:)
..11:30pm running off for the last bus. .
Posted By: Dave_L Re: about use Cwd and getcwd in Perl - 07/12/2002 7:34 AM
[code][/code]
Posted By: pangngan Re: about use Cwd and getcwd in Perl - 07/13/2002 6:10 PM
thanks dave_l . .had to do some reading to understand the regex that was used . .(ie. match from the beginning(^) as much as possible(*) of everything(.) to just before the last slash(\) ). . smile

still working on the rest of the stuff as detailed in the new members forum posting
© UBB.Developers