Re: RFC: Apache::Handlers

2002-01-03 Thread Geoffrey Young


> 
>use Apache::Handlers qw(CLEANUP PerlCleanupHandler);
> 
>our $global;
>our $other_global : PerlCleanupHandler;
>my  $lexical : PerlLogHandler(sub { print STDERR "$lexical\n"; });
> 
>CLEANUP {
>  our $global = undef;
>};

heh, seems like you should do this if only for the fun of it - nifty
idea.

sub printstuff : PerlHandler {...};

might be a neat piece of magic.

--Geoff



RFC: Apache::Handlers

2002-01-03 Thread James G Smith

This is a module I am working on, but haven't debugged yet.  Looking
for comments on what the name of the module should be if
Apache::Handlers is not a good name.  General comments on design are
welcome as well.


NAME
 Apache::Handlers

SYNOPSIS
 In code:

   use Apache::Handlers qw(CLEANUP PerlCleanupHandler);

   our $global;
   our $other_global : PerlCleanupHandler;
   my  $lexical : PerlLogHandler(sub { print STDERR "$lexical\n"; });

   CLEANUP {
 our $global = undef;
   };

 In httpd.conf:

   PerlModule Apache::Handlers
   PerlChildInitHandler Apache::Handlers

DESCRIPTION
 "Apache::Handlers" provides two different methods of
 declaring when code snippets should be run during the Apache
 request phase.

 If "Attribute::Handlers" is available, then attributes are
 defined that allow cleanup or setting of values during
 particular request phases.

 The code defined with the constructs provided by this module do
 not directly affect the success or failure of the request.
 Thus, this module does not provide a replacement for content,
 access, or other handlers.

BLOCK CONSTRUCTS
 The following allow for blocks of code to be run at the
 specified phase.  Note that these are subroutines taking a
 single code reference argument and thus require a
 terminating semi-colon (;).  They are named to be like the
 BEGIN, END, etc., constructs in Perl, though they are not
 quite at the same level in the language.

 If the code is seen and handled before Apache has handled a
 request, it will be run for each request.  Otherwise, it is
 pushed on the handler stack, run, and then removed at the
 end of the request.

 ACCESS
 AUTHEN
 AUTHZ
 CHILDEXIT
 CHILDINIT
 CLEANUP
 CONTENT
 FIXUP
 HEADERPARSER
 LOG
 POSTREADREQUEST
 TRANS
 TYPE

ATTRIBUTES
 If Attribute::Handlers is available, then the following
 attributes are available.

 If the attribute argument is a constant value (non-CODE
 reference), then the variable is assigned that value.
 Otherwise, the CODE is run and the return value is assigned
 to the variable.

 PerlAccessHandler
 PerlAuthenHandler
 PerlAuthzHandler
 PerlChildInitHandler
 PerlChildExitHandler
 PerlCleanupHandler
 PerlFixupHandler
 PerlHandler
 PerlHeaderParserHandler
 PerlLogHandler
 PerlPostReadRequestHandler
 PerlTransHandler
 PerlTypeHandler


--
James Smith <[EMAIL PROTECTED]>, 979-862-3725
Texas A&M CIS Operating Systems Group, Unix