perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Kütemeier <jkueteme...@wolf-systems.net>
Subject RE: Dynamic Embperl
Date Thu, 13 Nov 2003 10:14:10 GMT
> You could use that little script deployed with embperl which
> compiles pages offline (embpexec.pl or sth, I don't remember the
> name) and invoke it in backticks, but that is really really slow
> of course

Don't make it so complicated... ;-)

Ensure to set "AcceptPathInfo On" in your httpd.conf and perhaps
the following:

Embperl_AppName       Dynamic
Embperl_Object_Base   dynamic.epl
EMBPERL_OBJECT_APP    dynamicapp.pl

Choose one... or make your own ;-)
#  Embperl_UriMatch      "\.htm.?$|\.epl$|\/$|\.ehtm.?$|\.shtm.?$"
#  Embperl_UriMatch      ".*"
EMBPERL_OBJECT_FALLBACK dynamicfallback.html

content of fallback does not matter (we'll never call it ;-) )
but need it to get into dynamic.epl

minimal dynamicapp.pl:

sub init {
  return 0;
}

1;

your dynamic.epl (or base.epl):

[-

$r = shift;

my $uri = $r->param->uri;

[.. do something with the uri, e.g get table for it content..]

my $content = "<html>....</html>";  # save it into $content

# and display it...
Embperl::Execute({
  inputfile => '...some file', # is important for embperl (e.g. caching)
	                         # it identifies the "real" request with
it 
  mtime => undef,              # time for last modified...
  input => \$content
});

... if you need it you can even redirect the output with
  output => \$outputvar

-]

hope there's no typo and it helps...

perhaps Gerald knows a faster way ;-)

cu
Jörg 


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

wolf-systems IT-Services
Ihr Partner für ein sicheres und beständiges Netzwerk

http://www.wolf-systems.net

-----Original Message-----
From: Andre Landwehr [mailto:andre.landwehr@gmx.net] 
Sent: Thursday, November 13, 2003 10:14 AM
To: embperl@perl.apache.org
Subject: Re: Dynamic Embperl

On Thu, Nov 13, 2003 at 09:46:04AM +0100, Jochen Topf wrote:
> a) Compile something out of the database into Embperl. If it is only
>    Perl code you can just use eval, but with Embperl code its another
>    problem. I have no idea how to do this but maybe somebody else can
>    help.

You could use that little script deployed with embperl which
compiles pages offline (embpexec.pl or sth, I don't remember the
name) and invoke it in backticks, but that is really really slow
of course

>    (But it is sort of ugly, because if something changes you always
have
>    to rewrite the Apache config file, so if somebody has a better
>    solution, please tell me :-)

cool idea to use mod_rewrite, I hadn't thought of that yet. For
mod_rewrite you can specify regular expressions so you won't have
to rewrite the config file that often. Sth. like the following
(untested, most probably won't work since I never really used
mod_rewrite):
RewriteRule ^(/foo/bar/baz)(.*)$ /$0/process.epl?path=$1

Andre


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message