J. Peng wrote:
At what cases should we return a DECLINED or a OK from a handler?

Depends on the request phase you are running under, and ultimately, it's
dictated by apache [1]

I saw the handler of PerlTransHandler returns a
Apache2::Const::DECLINED but dont know why.

In a nutshell, there are 3 main type or return status:

OK

Means you kicked in to do what you were supposed to, and you succeded.

For instance, an PerlAuthHandler that checks username/password against
a database and finds a match, that's OK

DECLINED

Your handler kicked in, tried to do what it's interested in doing and
decided _not_ to do it, or had nothing to do, and usually, it means the
next handler down the handler stack will have a go at it.

For instance, a PerlOutputFilter might be registered, but only care to
filter text/html stuff. So it kicks in, looks at the content-type of the
current request, sees image/gif, so it returns DECLINED to indicate it's
passing its turn and somebody else should have a go at it.

ERRORS

There are many error codes one can return, mostly HTTP error codes, 404, 501,
etc.

Usually, when a handler doesn't return OK/DECLINED, whatever it returns will
be treated as an error, and the request will abort and report that particular
error.

[1] http://perl.apache.org/docs/2.0/user/handlers/intro.html#Stacked_Handlers

--
Philippe M. Chiasson     GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5
http://gozer.ectoplasm.org/       m/gozer\@(apache|cpan|ectoplasm)\.org/

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to