Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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.

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://697869]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2018-05-26 10:24 GMT
Find Nodes?
    Voting Booth?