hi, Are you using Embperl 1.x or 2?
I don't know about 2.x but in 1.x the default behavior of Embperl is to chdir to the folder where the current page is located. So you can use relative paths to test the existence of files. You can also use other common CGI environment variables, like: SCRIPT_NAME: path as seen by the web server SCRIPT_FILENAME: complete path in file system take a look at a complete list (I don't remember all) Regards, -- Luiz Fernando Ribeiro Engenho Soluções S/C Ltda -- Luiz Fernando Ribeiro Engenho Soluções S/C Ltda -- Luiz Fernando Ribeiro Engenho Soluções S/C Ltda On Sat, 2003-09-27 at 17:03, Cameron B. Prince wrote: > I guess a better way to ask my question is: > > Is there an environment variable available within Embperl that contains the > true filesystem path to the current page that's being called? If so, I could > simply remove the filename from it with a regex and replace with the file > I'm testing for existence. > > I don't want to hardcode a path such as your example. > > Thanks, > Cameron > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] > > Sent: Friday, September 26, 2003 7:58 PM > > To: Cameron B. Prince > > Cc: [EMAIL PROTECTED] > > Subject: Re: If -f Before Execute > > > > > > 1. It better be clear what the current working directory is, > > if you are > > going to depend on it. > > 2. What it is depends upon whether chdir is supported in your Apache > > platform, IIRC. > > > > Note that I am using 1.x still, so Execute is, in fact, part of > > HTML::Embperl. Also note that my real code uses chdir; this is merely > > an example that doesn't. > > > > [- $dir = '/usr/local/WWW.codepages'; > > $subpage = ${$rec}{type} . '.epl'; > > if (! -f "$dir/$subpage") { > > $subpage = 'default.epl'; > > } -] > > [- HTML::Embperl::Execute({ inputfile => "$dir/$subpage", > > escmode => 0 }); -] > > > > Ed > > > > On Fri, 26 Sep 2003, Cameron B. Prince wrote: > > > > > Hi, > > > > > > Does anyone have an example of a way to do a file existence > > test before > > > executing a file to include? It's not clear to me what the > > current working > > > directory is. > > > > > > Thanks, > > > Cameron > > > > > > > > > > > --------------------------------------------------------------------- > > > 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] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]