Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

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]
[marioroy]: IPC in MCE::Shared can handle 400k (sends) per second. That's seems a lot for being a pure-Perl module. After making the release, will come back and post a solution for a node by a fellow wanting faster logging.
[Corion]: While working on WWW::Mechanize:: Chrome, I had the suspicion that AnyEvent was doing something wrong, but I was able to swap it out for Mojolicious and the error persisted.
[Corion]: Of course, the error was in my own code ;)
[marioroy]: Corion, start and start_child in MCE::Hobo::Manager return a MCE::Hobo object, whereas P::FM returns the PID. I can have it return the PID though. I tried Hobo::Manager with several P::FM modules, just changed P::FM to MCE::Hobo::Manager and it works.
[marioroy]: I also have a Hobo driver for Forklift allowing folks to use in multiple classes, no conflicts with one another. That's not possible for P::FM.
[Discipulus]: congrats marioroy!
[marioroy]: CORE::wait works well eventhough multiple instances or classes using Hobo::Manager.
[Corion]: marioroy: I'm not sure what the normal use for the PID is in P:FM, but I guess that most programs just ignore or log it
[Corion]: Oh, yes, programs could call wait $pid, but if your $pid is an object, then you could add a ->wait method to it and wait $pid would call that automatically "thanks" to indirect object notation
[marioroy]: Just documentation edits is all that remains. Hobo::Simple provides foreach and forseq with identifier capability -- all transparently supporting array, hash, file handle, and seq 1 .. N.

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2017-05-26 08:42 GMT
Find Nodes?
    Voting Booth?