I am taking the Apache2::Request method, and will integrate the DB solution
as Chandra mentioned.



#!/usr/bin/perl -w
use strict;
use CGI;
use Apache2::Request;
use Data::Dumper;

print "Content-type: text/html\n\n";
my Apache2::Request $r = shift;
my $docroot = $r->document_root('/var/www/html/perl');
print $docroot;

For some reason, its still defaulting to /var/www/html. I need it to goto
/var/www/html/perl

Any thoughts?




On Feb 7, 2008 5:14 PM, Chandrakumar Muthaiah <[EMAIL PROTECTED]>
wrote:

>
> Perrin Harkins wrote:
> > On Feb 6, 2008 10:06 PM, Mag Gam <[EMAIL PROTECTED]> wrote:
> >
> >> Currently, when I open a file I have to use the
> >> absolute  path (/var/www/appname/top.inc). Is it possible for me to use
> just
> >> 'top.inc'?
> >>
> >
> > You can either use DocumentRoot
> > (
> http://perl.apache.org/docs/2.0/api/Apache2/RequestUtil.html#C_document_root_
> )
> > or use ModPerl::RegistryPreFork which will chdir to the directory your
> > script is in just like a normal CGI script does.  That would let you
> > use files relative to the script.
> >
> > - Perrin
> >
>
> Few quirks with document root. Your application may not be hosted under
> document root. you may have all your templates and customizations some
> where else.
>
> I think better option would be to define the template/support files
> location in Directory Configuration or in a Database configuration
> table. That would be more staple solution.
>
> in your .htaccess or on the Location/Directory Configuration put a line
> that says
>
> PerlSetVar AppsSupportFiles "/home/httpd/support/site1/template"
>
>
> and access this parameter from your $r->dir_config('AppsSupportFiles')
>
>
> I think this may be more customizable and scalable solution to your
> problem
>
> -Chandra
>

Reply via email to