in reply to Re^2: Mason newbe question
in thread Mason newbe question
Well, okay this is mostly Apache config not Perl:
# By default, Mason handles everything <Directory /var/www-mason> SetHandler perl-script PerlHandler HTML::Mason::ApacheHandler Options Includes FollowSymLinks AllowOverride None Order allow,deny Allow from all # whatever else... </Directory> # But we don't want bare autohandler or dhandler served by Apache <LocationMatch "handler$"> SetHandler perl-script PerlInitHandler Apache::Constants::NOT_FOUND </LocationMatch> # Nor do we want Mason touching stylesheets, javascript, or images <Location /css> SetHandler default-handler </Location> <Location /js> SetHandler default-handler Options FollowSymLinks Indexes </Location> <Location /img> SetHandler default-handler </Location>
And if there's some directory under Mason control that I want to switch to non-HTML, I can put this in an autohandler if for example I wanted to output JSON:
<%init>; # get rid of crap from parent autohandler $m->clear_buffer(); # change content-type $r->content_type('application/json; charset=utf-8'); # call any dhandlers, etc. $m->call_next(); $m->flush_buffer(); # but don't go back to the parent autohandler $m->abort(); </%init>
And well generally there are other tricks but it depends on what you're doing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Mason newbe question
by John M. Dlugosz (Monsignor) on Jul 17, 2008 at 01:54 UTC |