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

Monks I am a beginner in using mod_perl and template toolkit.The question I have is, if I use the template objects and apache modules to create the html's dynamically ( or static pages) how the client will request pages. Will the client request for the apache module which creates the page or will it request for the html.Also I read that the template toolkit provides a way to cache the pages.Can you teach me how the whole thing works with some example?The first thing I would like to do is to have a registration form and displaying the user entered data in a page using temp. tool and mod_perl Sorry for confusing.Please help me if you find time.Also I would really appreciate if some can point me to a site where I can get some samples

Replies are listed 'Best First'.
Re: mod_perl and template toolkit
by Joost (Canon) on Apr 25, 2002 at 08:14 UTC
    I will only try to answer question number one, as i'm not personally familiar with Template Toolkit.

    In short, TMTOWTDI :-)

    If you decide to create pages using a mod_perl handler, YOU decide on what basis you select the page that you return. It might be based on the "path" part of the url, or on the arguments supplied (i.e. http://host/some/stuff?page=somepage ) Or on the IP address of the user, or the user-agent string (but you really shouln't do THAT).

    Anyway, you might want to take a look at This section of the Template Toolkit manual. It includes a section on serving templates via mod_perl, using the requested URL to determine the template file.

    -- Joost

Re: mod_perl and template toolkit
by jehuni (Pilgrim) on Apr 25, 2002 at 10:46 UTC

    This information is all in the documentation. See Dynamic Content Generation Via Apache/mod_perl Handler in the web tutorial for a typical example. In any case, you can use pretty much any URL you want -- it's up to your module to take that URL and then determine which template to serve up. And amazingly enough, the Caching and Compiling Options section of the manual contains information about caching. :-)

    -jehuni

Re: mod_perl and template toolkit
by perrin (Chancellor) on Apr 25, 2002 at 18:03 UTC
    Don't get confused by the mention of caching. Template Toolkit does not cache output, it caches templates (to avoid reading them from disk and compiling them every time). If you want to cache output, you have to do that yourself.