Dear monks,
I am considering the following approach:
- Apache/mod_perl boots up, an XHTML template file is parsed and loaded into memory as an XML::Twig object.
- Upon each HTTP request, a copy of that twig is made. (I think I understand that mod_perl requires something like this because the original twig is persistant from request to request so modifying the 'original' will mess things up. Right?)
- The copy is then modified to suit the request. For example, there might be a <div class="content" /> in the XHTML that would be filled up with dynamic content from a database.
- The modified twig is flushed and displays in the requesting browser
Now, here are my questions:
- Is this a reasonable plan?
- Can I do this to decrease calls to the underlying parser and template file (ideally only on startup) and thus increase speed?
- Have you tried something like this?
Note that I have
no experience with mod_perl other than some notion of how it works and that I will want to use it. Please correct me if my assumptions seem wrong.
Thank you in advance for any and all responses!