> Hello everyone,
>
> Maybe it is not clear in the subject but let me explain my question. Here
is
> what i want to do:
> The browser requests a page that does not actually exist and should be
> outputed directly from a db or other kind of storage. The browser requests
a
> page for example (/article/2001/11/30/0001.html) then i should handle this
> request to parse the uri and out put the content. In mod_perl it`s clear
to
> me how to do this, but how can i do it in EmbperlObject. Should i make an
> empty directory /article with an OBJECT_BASE file in it which parses the
uri
> and outputs the dynamic content. Am i right? Are there any better
solutions
> to achieve what i want?
Answering myself :) I have found a way to handle such situations.
The FALLBACK_OBJECT is called when server encounters 404 error code file not
found.
So if i set ErrorDocument 404 to /path/to/err-404.html Embperl will handle
it and look also for an OBJECT_BASE file.
In the base.epl handling 404 can be done in this way:
[-
if ($req_rec->prev->status == 404) {
if ($req_rec->prev->uri =~
/\/embperl\/([0-9]{4})\/([0-9]{2})\/([0-9]{2})\/([0-9]+)\.html/) {
%fdat = $req_rec->prev->args();
$req_rec->status(200);
$http_headers_out{'Content-Type'} = "text/plain";
print OUT "Year: $1\nMonth: $2\nDay: $3\nArticle: $4\n-----[
\%fdat ]-----\n";
while (my($k,$v) = each %fdat) {
print OUT $k . " = " . $v . "\n";
}
exit;
} else {
Execute(.......);
}
}
-]
That handles everything in a manner i wanted. Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]