Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Mason newbe question

by ForgotPasswordAgain (Deacon)
on Jul 16, 2008 at 06:45 UTC ( #697869=note: print w/ replies, xml ) Need Help??


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.


Comment on Re^3: Mason newbe question
Select or Download Code
Re^4: Mason newbe question
by John M. Dlugosz (Monsignor) on Jul 17, 2008 at 01:54 UTC
    Can you specify, for example, that any directory named js has the default-handler? That is, cover foo/bar/js and this/that/js and any future directories I create with one declaration?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://697869]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2014-10-25 06:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (142 votes), past polls