Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Apache::Template perl directory configuration

by cleverett (Friar)
on Jul 26, 2003 at 18:36 UTC ( [id://278114]=perlquestion: print w/replies, xml ) Need Help??

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

I posted this to the Template Toolkit list, but that list dosn't seem very active and I need an answer yesterday, so:

I wish to reuse various templates in toto between different URLs but allow different means of generating the information I fill the template with depending on the uri.

So far, I've tried using TT2PluginBase and TT2ServiceModule directives inside Location blocks inside my apache configuration file without success. For example, with TT2PluginBase I'm getting this error:

Syntax error on line 27 of /home/ceverett/apache/conf/physemp.affiliate.loc.conf:
TT2PluginBase not allowed here

using this conf snippet:

TT2Params all TT2Headers size TT2Trim On <Location /affiliate/report/> Options ExecCGI SetHandler perl-script AuthType Physemp::Auth AuthName Affiliate TT2PluginBase Physemp::Template::Plugin::User # line 27 PerlHandler Apache::Template </Location> <Location /account_exec/report/> Options ExecCGI SetHandler perl-script AuthType Physemp::Auth AuthName Affiliate TT2PluginBase Physemp::Template::Plugin::Admin PerlHandler Apache::Template </Location>
I get the same type error using the TT2ServiceModule directive inside a Location block.

I'm using TT 2.10, Apache::Template 0.06, Apache 1.3.27 and mod_perl 1.28.

Is there a relatively straightforward way of modifying Apache::Template behavior per directory/location block?

Also, the Apache::Template docs don't say where specific configuration directives are allowed/forbidden. Ought I assume that all TT2* directives are forbidden inside Directory/Location blocks?

Replies are listed 'Best First'.
Re: Apache::Template perl directory configuration
by Chmrr (Vicar) on Jul 26, 2003 at 20:36 UTC

    A look at the Makefile.PL of Apache::Template shows that all of the configuration options have req_override set to "RSRC_CONF", which forces them to only appear in the main part of the config (or virtual host). So, as written, it look like you're up a creek, yes.

    Now, I'm not sure why they made those configuration directives are set up that way (as it seems to contradict the examples). You might try setting some or all of those req_override options to "OR_ALL" (meaning available anywhere). Glancing at the code, it looks like Apache::Template has DIR_MERGE subroutines, so it should work in theory. Re-run the modified Makefile.PL, make< && make test && make install, and give it a try. Let us know what happens. ;>

    perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'

      Well, I say this officially sucks now. Something's FUBAR.

      Nothing shows up in the browser window, I get a 304 response in the server access log, and even though TT2Headers isn't set, or even I just set it to TT2Headers size, I get the Modified-Since and Etag headers:

      Sent to server: GET /affiliate/report/basic_stats.html HTTP/1.1 Host: physemp.ceverett.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/2003 +0714 Debian/1.4-2 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9 +,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/ +*;q=0.1 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: PhysicianEmploymentAdSystem=WlZBLjxuUrsCvPj1K8gciw If-Modified-Since: Sat, 26 Jul 2003 20:41:10 GMT If-None-Match: "0-0-3f22e766" Cache-Control: max-age=0 Received from Server: HTTP/1.x 200 OK Date: Sat, 26 Jul 2003 22:05:43 GMT Server: Apache/1.3.27 (Unix) mod_perl/1.28 Last-Modified: Sat, 26 Jul 2003 20:41:10 GMT Etag: "0-0-3f22e766" Accept-Ranges: bytes Content-Length: 0 Content-Type: text/html X-Cache: MISS from physemp.ceverett.com
      I'm in a quandary. I'm at best a journeyman perl guy, and I'm under a heavy load. If I stick with packages that are at best rock-solid and at worst very well supported, I'm more likely to succeed. I posted about this same issue on the Template Toolkit list about 24 hours ago with only slightly different email (I cut & pasted it in to PM), and posted once before regarding the essentially the same issue (except using the TT2ServiceModule directive) about 48 hours before that without a response.

      Given that, it seems to me that TT is fine to use, but A::T would be a mistake for me at this time. That's too bad, because I have an upcoming large project that A::T used the way I'm trying to use it would be perfect for, IMO.

      Perhaps, I didn't ask the TT list correctly, and now I'm in everyone's bozo filters.

      Gah ... how quickly the bleeding edge comes. This is code that's supposed to go into production ... I'm not sure that a hacked Apache::Template is the Right Thing To Do (TM) ... bt what the heck, I have time for a quick try.

      OK, subbing OR_ALL for for RSRC_CONF in Makefile.PL, I'm finding it builds and installs, and with minor config twiddling, mod_perl starts up.

      Of course, now I have to see if the thing works as not designed or doesn't work as designed.

      Back in a bit.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://278114]
Approved by mattriff
Front-paged by mattriff
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-12-09 10:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which IDE have you been most impressed by?













    Results (53 votes). Check out past polls.