rvosa has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks, I am considering the following approach:
  1. Apache/mod_perl boots up, an XHTML template file is parsed and loaded into memory as an XML::Twig object.
  2. 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?)
  3. 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.
  4. The modified twig is flushed and displays in the requesting browser

Now, here are my questions: 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!

Replies are listed 'Best First'.
Re: XML::Twig and mod_perl
by perrin (Chancellor) on Oct 05, 2004 at 23:05 UTC
    That souns like it will work fine, but if you're looking for a template system using standard HTML constructs you might be better off trying Petal before writing your own from scratch.