You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Sam Carleton <sc...@gmail.com> on 2007/04/08 15:12:43 UTC

"one module per task"

On 4/6/07, Nick Kew <ni...@webthing.com> wrote:
> A good starting point is "one module per task".  How many tasks
> does your application comprise?  How many of those tasks can
> be accomplished using existing modules?

I like the concept on one module one task, but I want to try to keep
everything in one main binary, sort of like having one EXE in Windows
for a program.

I was reading through my old book "Writing Apache Modules in Perl and
C" and it looked like it was possible to put multiple handlers in one
perl file.  Is it possible to put multiple handlers in one C Module?
This seems like a logical approach to having one module doing
different things, simply have it contain a different handler for each
task.

When Apache sees

<Location /coolapp>
   SetHandler mod_my_cool_app
<Location>

How does it know that mod_my_cool_app is associated with
mod_my_cool_app.so?  Is it purely from the LoadModule or is there
something in the module that I am missing?

Sam

Re: "one module per task"

Posted by Sam Carleton <sc...@gmail.com>.
On 4/9/07, Joe Lewis <jo...@joe-lewis.com> wrote:
> Sam Carleton wrote:
> > When Apache sees
> >
> > <Location /coolapp>
> >   SetHandler mod_my_cool_app
> > <Location>
> >
> > How does it know that mod_my_cool_app is associated with
> > mod_my_cool_app.so?  Is it purely from the LoadModule or is there
> > something in the module that I am missing?
>
> It doesn't.  Simply mod_my_cool_app.so has a function which checks the
> handler, and either completes the request or returns 'DECLINED" so that
> another module can handle the request.

Joe,

Oh, that explains the first line of my hander looking something like this:

if (strcmp(r->handler, "mod_my_cool_app"))  return DECLINED;

I get it now!  This also explains why one is able to place the hander
at the very first, first, middle, end or very end of the chain.
Slowly, oh so slowly, it begins to come clearer (mind you when it
starts off looking like mudd, clearer doesn't mean too much<grin>).

Thanks!

Sam

Re: "one module per task"

Posted by Joe Lewis <jo...@joe-lewis.com>.
Sam Carleton wrote:
> When Apache sees
>
> <Location /coolapp>
>   SetHandler mod_my_cool_app
> <Location>
>
> How does it know that mod_my_cool_app is associated with
> mod_my_cool_app.so?  Is it purely from the LoadModule or is there
> something in the module that I am missing?

It doesn't.  Simply mod_my_cool_app.so has a function which checks the 
handler, and either completes the request or returns 'DECLINED" so that 
another module can handle the request.

Joe
-- 
Joseph Lewis <http://sharktooth.org/>
"Divide the fire, and you will sooner put it out." - Publius Syrus