Stories
Slash Boxes
Comments
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

use Perl Log In

Log In

[ Create a new account ]

Journal of sumdeus (4830)

Wednesday February 25, 2004
01:08 PM

mod_perl, grrr

[ #17620 ]
I've been messing around with mod_perl and template toolkit for the last few days. I've been reading through a lot of information on the both. Before I started this, I knew how they both worked, but had never actually created a mod_perl installation from scratch. Now I have my own!

So I'm really only trying to do something simple with them both to begin, I want the following:
  • Requests to /foo.htm, which is actually a template, is taken care of by mod_perl

Seems simple enough? Here's the setup I have right now... all requests to /foo.html are converted using mod_rewrite to /mod-perl/handler.pl?file=foo.html. So I have Apache::Registry as the real "handler".

What I'd really like, is to have my own handler, which I "attempted" without success. You will want to ask, "what was the problem"? Of course, I'd answer, with a smart ass smile, "it didn't work!". No,no, the problem was that it didn't seem like it made sense in this case... perhaps overkill? I just don't know the most appropriate way to map a request for an html file through a custom mod_perl handler to template toolkit. Is there some 'industry' standard? I can't find any useful examples, all I find are the generic "do-this" tutorials... even in the safari/oreilly books. Maybe I'm browsing the wrong one!

Any hints ,URLS's, or book names would be greatly appreciated for this mod_perl administrating neophyte.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • See Apache::Template - like Apache::Registry, but for templates instead of CGI.pm scripts.
    --
    • Randal L. Schwartz
    • Stonehenge
    • Thanks Randal. Now all I have to do is figure out how in the hell to get it installed without gcc on the machine.
      • What's your OS ? and how did you install mod_perl without gcc :) ?
        • Dare I say it's a hosting company... where they/I have about 200 perl modules installed, but for some reason this isn't one of them. They don't have gnu tools for security reasons, of course for another 15 bucks a month I can get them. I'm stuck with them for another 1/2 a year, so I have to make due. Unfortunately I need gcc for the xs stuff.
  • 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

    • 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.