Hello,

I have a problem which I could not solve prefectly yet. I'm using my own templating system which is basically quite simple. Every template is translateted into a subroutine that will return the content of the template :

<body>you are <$username$></body>

would become something like

my $template = sub { my $data = "";
   $data .= "<body>you are ".&username()."</body>";
return $data }

This way I can store $template(the sub-ref) for later use (after evaluating the above code); which is a very fast (kind of precompiling). So far everything works fine, but I'm not able to share this sub-ref with other childs. To get the most out of it (so far), the "precompiled" codeto be evaluated is dumped out and when apache starts, all those files are loaded again. This way the apache mother has all templates (subroutines) precompiled in memory and all childs will share the memory with it. But as soon as one template is changed (I also store a "last-changed" value for each template that is checked), the template is recompiled and the resulting sub-ref is just used within the current child. Therefore every process has to recompile this template (the "last-changed" value also isn't shared), even the childs that are spawned after I changed the template.

IMO it seems to be reasonable that every actually running apache thread (when I change the template), has to recompile it. BUT, the optimum would be, that the mother also would recompile the template, so every newly spawned child would share this memory with the mother. And that is where I'm stuck. So far I need to restart apache (so the dumped-out precompiled template subroutine is loaded within the mother) to get the templates shared across all childs.

Maybe anyone of you knows how this could be done ??

thxs and greetings,
Marcel Greter


-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html



Reply via email to