[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: Question about open()
From:       "Perrin Harkins" <perrin () elem ! com>
Date:       2008-02-11 19:45:46
Message-ID: 66887a3d0802111145k7483a679s5def2064e6252191 () mail ! gmail ! com
[Download RAW message or body]

On Feb 10, 2008 12:37 PM, Mag Gam <magawake@gmail.com> wrote:
> I am trying to change DocumentRoot because, currently I am using open()  to
> load templates for my website. I have header, menu, footer in 3 seperate
> files, and I generate content like that. It works fine now, just not too
> dynamic when I want to move the stuff around. I have
> open("/var/www/perl/header.file") hardcoded, which is a pain. I just want
> open ("header.file").
>
> If I do open("header.file") its trying to read from DocumentRoot ie.
> /var/www/header.inc, which does not exist.

That's not related to DocumentRoot.  The open() command opens files
relative to your current working directory.  If you use
ModPerl::RegsitryPreFork, that will be the same directory your script
is in.  Alternatively, you can chdir() to the directory you want.
What you're trying to do right now with DocumentRoot should be done
with chdir() instead.

- Perrin
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic