Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • First off, I am not a fan of Apache::Template, or of mapping your URLs directly to the name of a template file. I think the URL and the name of the file you're going to run should have only a loose mapping, therefore I usually just map my URL to a handler, and then let the handler decide which template to run based on what it's doing. For example, requesting /login/ might result in running login_form.html, or maybe login_error.html, etc.

    However, if I were trying to do what you are doing (map /foo.html to a handler that will run a template called foo.html), the easiest approach is the Files directive:

      <Files *.html>
        SetHandler  perl-script
        PerlHandler My::TT::Handler
    Then in My::TT::Handler you just look at the URI (see the documentation for the $r request object on the mod_perl site) and decide which file to run through TT based on that.

    This being apache, there are 1000 other ways to do it. Some are in the new TT book, one of them in on-line here [], and all of the ways people do it with other systems like HTML::Template apply to TT as well.

    • Very helpful, and nice since I don't need to install any additional modules. I will goof around with the handler... I was using Location directive instead of the Files so things were a little goofy.

      Appreciate the comment.