Re: one module per task

2007-04-09 Thread Sam Carleton

On 4/9/07, Joe Lewis [EMAIL PROTECTED] 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 muchgrin).

Thanks!

Sam


one module per task

2007-04-08 Thread Sam Carleton

On 4/6/07, Nick Kew [EMAIL PROTECTED] 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