First Gerald, thanks for the fix using File::Basename to strip of the path
from the file request. I haven't got it working yet but hopefully will soon.

In the meantime, I stumbled across another solution purely accidently.

As you state, if a file request comes into /htdocs/domain_name for
filename.html, but filename.html only exists in /htdocs, Embperl will not
walk up the directory tree to serve the file. Instead it will return a 404
error because the file does not exist in the requested path.

However, if one goes into /htdocs/domain_name and creates filename.html
(even with a touch command), then [- Execute ('../*') -] WILL work because
the originally requested file was found, hence no 404 error, and then it
goes one directory up to retreive the originally requested file.

Even more interesting is that [- Execute ('*') -] aso works, which is
strange since filename.html is in the subdirectory and therefore you'd think
that Embperl wouldn't walk up the directory tree. But Embperl is smart
enough to realize that filename.html is empty (since it was created with the
touch command) and therefore will ignore it and go up to the next directory
to get the file. Put some real content in filename.html in the subdirectory
and Embperl will serve it, thus overriding what is in the parent directory.

Of course, putting real content into file.html in a specific subdirectory
doesn't change the content for any other subdirectory. They continue to get
the file.html in the parent directory.


The only drawback to this is having to create all the empty filenames in
each directory. However, only the filenames in the parent directory
(/htdocs) have to be maintained. Changes to any of these files will be
reflected in any of the subdirectories. Thus Embperl fulfills my goal for a
templating system that can be used to maintain dozens or hundreds of web
sites with a common framework.

Great program.

Dean Powers





-----Original Message-----
From: Gerald Richter [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 30, 2002 8:53 PM
To: Powers, Dean; 'Ed Grimm'
Cc: [EMAIL PROTECTED]
Subject: Re: [ -Execute ( ' * ' ) -] Doesn't Work!


>
> So, my question (which hopefully Gerald will see)

I see (and answer, as far as other didn't done it already) all the questions
on the list, but I not always have time to immediatly answer them...

> is WHY Embperl works
> perfectly for serving base.epl, notfound.html, and explicitly requested
> files [- Execute ('filename.html') -] out of /htdocs for the domain
> /htdocs/mybookprices, but can't seem to serve up boilerplate.html when
> requested by [- Execute ('*') - ].
>

Embperl::Object only searches for files that doesn't have a path e.g. it
searches for content.html, but not for /usr/local/apache/htdocs/content.html
. The file you requested is passed by Apache with the full path to Embperl,
that's the reason why Embperl did not search for it. This normaly makes
sense, since you want to show the user the document he requested.

In your case it's different. To make it working you have to strip the path.
The easiest way to do that is to create an application object. E.g.

app.pl

use File::Basename ;
sub init
    {
    my ($self, $r) = @_ ;

    $r -> param -> filename (basename ($r -> param -> filename)) ;

    return 0 ;
    }

In your httpd.conf say

EMBPERL_OBJECT_APP app.pl

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     [EMAIL PROTECTED]         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------

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

Reply via email to