perl-docs-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-docs/src/docs/2.0/user/handlers http.pod
Date Mon, 12 Jan 2004 08:49:38 GMT
stas        2004/01/12 00:49:38

  Modified:    src/docs/2.0/user/handlers http.pod
  Log:
  new section: HTTP Request Handler Skeleton
  
  Revision  Changes    Path
  1.27      +41 -0     modperl-docs/src/docs/2.0/user/handlers/http.pod
  
  Index: http.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/handlers/http.pod,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -u -r1.26 -r1.27
  --- http.pod	12 Jan 2004 04:32:08 -0000	1.26
  +++ http.pod	12 Jan 2004 08:49:38 -0000	1.27
  @@ -8,6 +8,47 @@
   mod_perl.
   
   
  +=head1 HTTP Request Handler Skeleton
  +
  +All HTTP Request handlers have the following structure:
  +
  +  package MyApache::MyHandlerName;
  +  
  +  # load modules that are going to be used
  +  use ...;
  +  
  +  # compile (or import) constants
  +  use Apache::Const -compile => qw(OK);
  +  
  +  sub handler {
  +      my $r = shift;
  +      
  +      # handler code comes here
  +      
  +      return Apache::OK; # or another status constant
  +  }
  +  1;
  +
  +First, the package is declared. Next, the modules that are going to be
  +used are loaded and constants compiled.
  +
  +The handler itself coming next and usually it receives the only
  +argument: the
  +C<L<Apache::RequestRec|docs::2.0::api::Apache::RequestRec>> object.
  +If the handler is declared as L<a method handler
  +|docs::2.0::user::coding::coding/Method_Handlers>:
  +
  +  sub handler : method {
  +      my($class, $r) = @_;
  +
  +the handler receives two arguments: the class name and the
  +C<L<Apache::RequestRec|docs::2.0::api::Apache::RequestRec>> object.
  +
  +The handler ends with L<a return
  +code|docs::2.0::user::handlers::intro/Stacked_Handlers> and the file
  +is ended with C<1;> to return true when it gets loaded.
  +
  +
   =head1 HTTP Request Cycle Phases
   
   Those familiar with mod_perl 1.0 will find the HTTP request cycle in
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-cvs-help@perl.apache.org


Mime
View raw message