You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs-cvs@perl.apache.org by ge...@apache.org on 2005/04/04 22:38:57 UTC

svn commit: r160096 [2/2] - in perl/modperl/docs/trunk/src/docs/2.0: api/APR/ api/Apache2/ devel/core/ os/win32/ user/coding/ user/config/ user/handlers/ user/intro/ user/porting/

Modified: perl/modperl/docs/trunk/src/docs/2.0/user/handlers/filters.pod
URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/user/handlers/filters.pod?view=diff&r1=160095&r2=160096
==============================================================================
--- perl/modperl/docs/trunk/src/docs/2.0/user/handlers/filters.pod (original)
+++ perl/modperl/docs/trunk/src/docs/2.0/user/handlers/filters.pod Mon Apr  4 13:38:47 2005
@@ -130,7 +130,7 @@
           $f->print($buffer);
       }
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   1;
 
@@ -143,7 +143,7 @@
   </Files>
 
 Filter handlers are similar to HTTP handlers, they are expected to
-return C<Apache2::OK> or C<Apache2::DECLINED>, but instead of receiving
+return C<Apache2::Const::OK> or C<Apache2::Const::DECLINED>, but instead of receiving
 C<$r> (the request object) as the first argument, they receive C<$f>
 (the filter object).
 
@@ -357,7 +357,7 @@
           finalize($f);
       }
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   sub init     { ... }
   sub process  { ... }
@@ -411,13 +411,13 @@
       $f->ctx($ctx);
       warn "filter was invoked $ctx->{invoked} times\n";
   
-      return Apache2::DECLINED;
+      return Apache2::Const::DECLINED;
   }
 
 Since this filter handler doesn't consume the data from the upstream
-filter, it's important that this handler returns C<Apache2::DECLINED>,
+filter, it's important that this handler returns C<Apache2::Const::DECLINED>,
 in which case mod_perl passes the current bucket brigade to the next
-filter. If this handler returns C<Apache2::OK>, the data will be simply
+filter. If this handler returns C<Apache2::Const::OK>, the data will be simply
 lost. And if that data included a special EOS token, this may wreck
 havoc.
 
@@ -539,7 +539,7 @@
       my $rv = $f->next->get_brigade($bb, $mode, $block, $readbytes);
       return $rv unless $rv == APR::SUCCESS;
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
 
 When the input filter I<in()> is invoked, it first asks the upstream
@@ -606,7 +606,7 @@
       my $rv = $f->next->pass_brigade($bb);
       return $rv unless $rv == APR::SUCCESS;
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   1;
 
@@ -936,7 +936,7 @@
   
       $r->add_output_filter(\&MyApache2::FilterObfuscate::handler);
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   1;
@@ -1061,7 +1061,7 @@
   sub init : FilterInitHandler {
       my $f = shift;
       #...
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
 
 The attribute C<FilterInitHandler> marks the Perl function suitable to
@@ -1075,7 +1075,7 @@
   sub init : FilterInitHandler {
       my $f = shift;
       $f->remove() if should_remove_filter();
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
 
 Not all C<Apache2::Filter> methods can be used in the init handler,
@@ -1102,7 +1102,7 @@
   sub filter : FilterRequestHandler FilterHasInitHandler(\&init) {
       my ($f, $bb) = @_;
       # ...
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
 
 While attributes are parsed during the code compilation (it's really a
@@ -1170,12 +1170,12 @@
   
       $r->print("args:\n", $r->args, "\n");
   
-      if ($r->method_number == Apache2::M_POST) {
+      if ($r->method_number == Apache2::Const::M_POST) {
           my $data = content($r);
           $r->print("content:\n$data\n");
       }
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   use Apache2::Const -compile => qw(MODE_READBYTES);
@@ -1191,7 +1191,7 @@
       my $data = '';
       my $seen_eos = 0;
       do {
-          $r->input_filters->get_brigade($bb, Apache2::MODE_READBYTES,
+          $r->input_filters->get_brigade($bb, Apache2::Const::MODE_READBYTES,
                                          APR::BLOCK_READ, IOBUFSIZE);
   
           for (my $b = $bb->first; $b; $b = $bb->next($b)) {
@@ -1278,7 +1278,7 @@
           return $rv unless $rv == APR::SUCCESS;
       }
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   sub bb_dump {
@@ -1567,7 +1567,7 @@
   sub handler : FilterConnectionHandler {
       my($f, $bb, $mode, $block, $readbytes) = @_;
   
-      return Apache2::DECLINED if $f->ctx;
+      return Apache2::Const::DECLINED if $f->ctx;
   
       my $rv = $f->next->get_brigade($bb, $mode, $block, $readbytes);
       return $rv unless $rv == APR::SUCCESS;
@@ -1585,7 +1585,7 @@
           }
       }
   
-      Apache2::OK;
+      Apache2::Const::OK;
   }
   1;
 
@@ -1634,10 +1634,10 @@
 context to 1.
 
 To optimize the speed, the filter immediately returns
-C<Apache2::DECLINED> when it's invoked after the substitution job has
+C<Apache2::Const::DECLINED> when it's invoked after the substitution job has
 been done:
 
-    return Apache2::DECLINED if $f->ctx;
+    return Apache2::Const::DECLINED if $f->ctx;
 
 In that case mod_perl will call C<get_brigade()> internally which will
 pass the bucket brigade to the downstream filter. Alternatively the
@@ -1645,7 +1645,7 @@
 
     my $rv = $f->next->get_brigade($bb, $mode, $block, $readbytes);
     return $rv unless $rv == APR::SUCCESS;
-    return Apache2::OK if $f->ctx;
+    return Apache2::Const::OK if $f->ctx;
 
 but this is a bit less efficient.
 
@@ -1655,7 +1655,7 @@
 
   if ($f->ctx) {
       $f->remove;
-      return Apache2::DECLINED;
+      return Apache2::Const::DECLINED;
   }
 
 However, this can't be used with Apache 2.0.49 and lower, since it has
@@ -1679,7 +1679,7 @@
 Finally we set the context to 1, so we know not to apply the
 substitution on the following data and break from the I<for> loop.
 
-The handler returns C<Apache2::OK> indicating that everything was
+The handler returns C<Apache2::Const::OK> indicating that everything was
 fine. The downstream filter will receive the bucket brigade with one
 bucket modified.
 
@@ -1707,7 +1707,7 @@
       $r->set_content_length(length $response);
       $r->print($response);
   
-      Apache2::OK;
+      Apache2::Const::OK;
   }
   
   1;
@@ -1817,7 +1817,7 @@
           $bb->insert_tail($b);
       }
   
-      Apache2::OK;
+      Apache2::Const::OK;
   }
   
   1;
@@ -1894,7 +1894,7 @@
           $f->print(lc $buffer);
       }
   
-      Apache2::OK;
+      Apache2::Const::OK;
   }
   1;
 
@@ -2005,7 +2005,7 @@
       $r->print(1..9, "0\n");
       $r->print('a'..'z', "\n");
   
-      Apache2::OK;
+      Apache2::Const::OK;
   }
   1;
 
@@ -2045,7 +2045,7 @@
           }
       }
   
-      Apache2::OK;
+      Apache2::Const::OK;
   }
   1;
 
@@ -2115,7 +2115,7 @@
           $f->ctx($leftover) if defined $leftover;
       }
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
 
 The handler uses the C<$leftover> variable to store unprocessed data
@@ -2172,7 +2172,7 @@
       my $rv = $f->next->pass_brigade($bb_ctx);
       return $rv unless $rv == APR::SUCCESS;
   
-      Apache2::OK;
+      Apache2::Const::OK;
   }
   1;
 
@@ -2318,14 +2318,14 @@
   
       $r->content_type('text/plain');
   
-      if ($r->method_number == Apache2::M_POST) {
+      if ($r->method_number == Apache2::Const::M_POST) {
           my $data = read_post($r);
           #warn "HANDLER READ: $data\n";
           my $length = length $data;
           $r->print("read $length chars");
       }
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   sub read_post {
@@ -2336,7 +2336,7 @@
       my $data = '';
       my $seen_eos = 0;
       do {
-          $r->input_filters->get_brigade($bb, Apache2::MODE_READBYTES,
+          $r->input_filters->get_brigade($bb, Apache2::Const::MODE_READBYTES,
                                          APR::BLOCK_READ, IOBUFSIZE);
   
           for (my $b = $bb->first; $b; $b = $bb->next($b)) {
@@ -2417,7 +2417,7 @@
           warn "storing the remainder: $len bytes\n";
       }
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   # split a string into tokens of TOKEN_SIZE bytes and a remainder
@@ -2545,7 +2545,7 @@
       my $ctx = context($f);
   
       # pass through unmodified
-      return Apache2::DECLINED if $ctx->{state};
+      return Apache2::Const::DECLINED if $ctx->{state};
   
       # get data, do some processing, send it out
       process(); # your code comes here
@@ -2553,7 +2553,7 @@
       # change the state if some condition is reached
       $ctx->{state}++ if $done_condition;
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   sub context {
@@ -2592,7 +2592,7 @@
       }
   
       my $c = $f->c;
-      if ($c->keepalive == Apache2::CONN_KEEPALIVE &&
+      if ($c->keepalive == Apache2::Const::CONN_KEEPALIVE &&
           $ctx->{state} && $c->keepalives > $ctx->{keepalives}) {
   
           $ctx->{state}      = 0;

Modified: perl/modperl/docs/trunk/src/docs/2.0/user/handlers/http.pod
URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/user/handlers/http.pod?view=diff&r1=160095&r2=160096
==============================================================================
--- perl/modperl/docs/trunk/src/docs/2.0/user/handlers/http.pod (original)
+++ perl/modperl/docs/trunk/src/docs/2.0/user/handlers/http.pod Mon Apr  4 13:38:47 2005
@@ -25,7 +25,7 @@
       
       # handler code comes here
       
-      return Apache2::OK; # or another status constant
+      return Apache2::Const::OK; # or another status constant
   }
   1;
 
@@ -129,9 +129,9 @@
 Before discussing each handler in detail remember that if you use
 L<the stacked handlers
 feature|docs::2.0::user::handlers::intro/Stacked_Handlers> all
-handlers in the chain will be run as long as they return C<Apache2::OK>
-or C<Apache2::DECLINED>. Because stacked handlers is a special case. So
-don't be surprised if you've returned C<Apache2::OK> and the next
+handlers in the chain will be run as long as they return C<Apache2::Const::OK>
+or C<Apache2::Const::DECLINED>. Because stacked handlers is a special case. So
+don't be surprised if you've returned C<Apache2::Const::OK> and the next
 handler was still executed. This is a feature, not a bug.
 
 Now let's discuss each of the mentioned handlers in detail.
@@ -211,7 +211,7 @@
   sub handler {
       my $r = shift;
       $^T = $r->request_time;
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   1;
 
@@ -290,13 +290,13 @@
       $r->uri("/perl/news.pl");
       $r->args("date=$date&id=$id&page=$page");
   
-      return Apache2::DECLINED;
+      return Apache2::Const::DECLINED;
   }
   1;
 
 The handler matches the URI and assigns a new URI via C<$r-E<gt>uri()>
 and the query string via C<$r-E<gt>args()>. It then returns
-C<Apache2::DECLINED>, so the next translation handler will get invoked,
+C<Apache2::Const::DECLINED>, so the next translation handler will get invoked,
 if more rewrites and translations are needed.
 
 Of course if you need to do a more complicated rewriting, this handler
@@ -348,7 +348,7 @@
       my $r = shift;
   
       # skip ap_directory_walk stat() calls
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   1;
 
@@ -370,10 +370,10 @@
   sub handler {
       my $r = shift;
   
-      return Apache2::DECLINED if $r->method_number == Apache2::M_TRACE;
+      return Apache2::Const::DECLINED if $r->method_number == Apache2::Const::M_TRACE;
   
       # skip ap_directory_walk stat() calls
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   1;
 
@@ -457,13 +457,13 @@
   sub handler {
       my $r = shift;
   
-      return Apache2::DECLINED unless $r->method eq METHOD;
+      return Apache2::Const::DECLINED unless $r->method eq METHOD;
   
       $r->server->method_register(METHOD);
       $r->handler("perl-script");
       $r->push_handlers(PerlResponseHandler => \&send_email_handler);
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   sub send_email_handler {
@@ -476,7 +476,7 @@
   
       $r->content_type('text/plain');
       $r->print($status ? "ACK" : "NACK");
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   use APR::Brigade ();
@@ -495,7 +495,7 @@
       my $data = '';
       my $seen_eos = 0;
       do {
-          $r->input_filters->get_brigade($bb, Apache2::MODE_READBYTES,
+          $r->input_filters->get_brigade($bb, Apache2::Const::MODE_READBYTES,
                                          APR::BLOCK_READ, IOBUFSIZE);
   
           for (my $b = $bb->first; $b; $b = $bb->next($b)) {
@@ -530,7 +530,7 @@
 request method is not equal to C<EMAIL> (set in the C<METHOD>
 constant):
 
-      return Apache2::DECLINED unless $r->method eq METHOD;
+      return Apache2::Const::DECLINED unless $r->method eq METHOD;
 
 Next it tells Apache that this new method is a valid one and that the
 C<perl-script> handler will do the processing.
@@ -550,7 +550,7 @@
 
 The function terminates the header_parser phase by:
 
-      return Apache2::OK;
+      return Apache2::Const::OK;
 
 All other phases run as usual, so you can reuse any HTTP protocol
 hooks, such as authentication and fixup phases. 
@@ -569,11 +569,11 @@
 
 Finally return to the client a simple response acknowledging that
 email has been sent and finish the response phase by returning
-C<Apache2::OK>:
+C<Apache2::Const::OK>:
 
       $r->content_type('text/plain');
       $r->print($status ? "ACK" : "NACK");
-      return Apache2::OK;
+      return Apache2::Const::OK;
 
 Of course you will want to add extra validations if you want to use
 this code in production. This is just a proof of concept
@@ -687,8 +687,8 @@
 C<L<DIR|docs::2.0::user::config::config/item_DIR>>.
 
 The concept behind access checker handler is very simple, return
-C<Apache2::FORBIDDEN> if the access is not allowed, otherwise return
-C<Apache2::OK>.
+C<Apache2::Const::FORBIDDEN> if the access is not allowed, otherwise return
+C<Apache2::Const::OK>.
 
 The following example handler denies requests made from IPs on the
 blacklist.
@@ -711,8 +711,8 @@
       my $r = shift;
   
       return exists $bad_ips{$r->connection->remote_ip}
-          ? Apache2::FORBIDDEN
-          : Apache2::OK;
+          ? Apache2::Const::FORBIDDEN
+          : Apache2::Const::OK;
   }
   
   1;
@@ -754,8 +754,8 @@
 
 This phase is usually used to verify a user's identification
 credentials. If the credentials are verified to be correct, the
-handler should return C<Apache2::OK>.  Otherwise the handler returns
-C<Apache2::HTTP_UNAUTHORIZED> to indicate that the user has not
+handler should return C<Apache2::Const::OK>.  Otherwise the handler returns
+C<Apache2::Const::HTTP_UNAUTHORIZED> to indicate that the user has not
 authenticated successfully.  When Apache sends the HTTP header with
 this code, the browser will normally pop up a dialog box that prompts
 the user for login information.
@@ -789,19 +789,19 @@
       my $r = shift;
   
       my ($status, $password) = $r->get_basic_auth_pw;
-      return $status unless $status == Apache2::OK;
+      return $status unless $status == Apache2::Const::OK;
   
-      return Apache2::OK 
+      return Apache2::Const::OK 
           if SECRET_LENGTH == length join " ", $r->user, $password;
   
       $r->note_basic_auth_failure;
-      return Apache2::HTTP_UNAUTHORIZED;
+      return Apache2::Const::HTTP_UNAUTHORIZED;
   }
   
   1;
 
 First the handler retrieves the status of the authentication and the
-password in plain text. The status will be set to C<Apache2::OK> only
+password in plain text. The status will be set to C<Apache2::Const::OK> only
 when the user has supplied the username and the password
 credentials. If the status is different, we just let Apache handle
 this situation for us, which will usually challenge the client so
@@ -840,7 +840,7 @@
 storing passwords in clear is a bad idea.
 
 Finally if our authentication fails the handler calls
-note_basic_auth_failure() and returns C<Apache2::HTTP_UNAUTHORIZED>, which
+note_basic_auth_failure() and returns C<Apache2::Const::HTTP_UNAUTHORIZED>, which
 sets the proper HTTP response headers that tell the client that its
 user that the authentication has failed and the credentials should be
 supplied again.
@@ -895,9 +895,9 @@
 As this phase is tightly connected to the authentication phase, the
 handlers registered for this phase are only called when the requested
 resource is password protected, similar to the auth phase. The handler
-is expected to return C<Apache2::DECLINED> to defer the decision,
-C<Apache2::OK> to indicate its acceptance of the user's authorization,
-or C<Apache2::HTTP_UNAUTHORIZED> to indicate that the user is not
+is expected to return C<Apache2::Const::DECLINED> to defer the decision,
+C<Apache2::Const::OK> to indicate its acceptance of the user's authorization,
+or C<Apache2::Const::HTTP_UNAUTHORIZED> to indicate that the user is not
 authorized to access the requested document.
 
 This phase is of type
@@ -935,15 +935,15 @@
           my($section) = $r->uri =~ m|^/company/(\w+)/|;
           if (defined $section && exists $protected{$section}) {
               my $users = $protected{$section};
-              return Apache2::OK if grep { $_ eq $user } @$users;
+              return Apache2::Const::OK if grep { $_ eq $user } @$users;
           }
           else {
-              return Apache2::OK;
+              return Apache2::Const::OK;
           }
       }
   
       $r->note_basic_auth_failure;
-      return Apache2::HTTP_UNAUTHORIZED;
+      return Apache2::Const::HTTP_UNAUTHORIZED;
   }
   
   1;
@@ -963,7 +963,7 @@
 authentication fails, i.e, calls:
 
       $r->note_basic_auth_failure;
-      return Apache2::HTTP_UNAUTHORIZED;
+      return Apache2::Const::HTTP_UNAUTHORIZED;
 
 The configuration is similar to the one in L<the previous
 section|/PerlAuthenHandler>, this time we just add the 
@@ -1032,7 +1032,7 @@
 depending on which type of response handler is wanted.
 
 Writing a C<PerlTypeHandler> handler which sets the content-type value
-and returns C<Apache2::DECLINED> so that the default handler will do
+and returns C<Apache2::Const::DECLINED> so that the default handler will do
 the rest of the work, is not a good idea, because mod_mime will
 probably override this and other settings.
 
@@ -1095,7 +1095,7 @@
           $r->set_handlers(PerlResponseHandler => $exts{$ext}->[CALLBACK]);
       }
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   sub cgi_handler { content_handler($_[0], 'cgi') }
@@ -1108,7 +1108,7 @@
       $r->content_type('text/plain');
       $r->print("A handler of type '$type' was called");
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   1;
@@ -1215,7 +1215,7 @@
       $r->content_type('text/plain');
       $r->print('sub handler ', B::Deparse->new->coderef2text(\&handler));
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   1;
 
@@ -1287,7 +1287,7 @@
       my $r = shift;
   
       my($username) = $r->uri =~ m|^/users/([^/]+)|;
-      return Apache2::DECLINED unless defined $username;
+      return Apache2::Const::DECLINED unless defined $username;
   
       my $entry = sprintf qq(%s [%s] "%s" %d %d\n),
           $r->connection->remote_ip, scalar(localtime),
@@ -1300,14 +1300,14 @@
       print $fh $entry;
       close $fh;
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   1;
 
 First the handler tries to figure out what username the request is
 issued for, if it fails to match the URI, it simply returns
-C<Apache2::DECLINED>, letting other log handlers to do the
-logging. Though it could return C<Apache2::OK> since all other log
+C<Apache2::Const::DECLINED>, letting other log handlers to do the
+logging. Though it could return C<Apache2::Const::OK> since all other log
 handlers will be run anyway.
 
 Next it builds the log entry, similar to the default I<access_log>
@@ -1457,7 +1457,7 @@
   
       $r->push_handlers(PerlCleanupHandler => \&cleanup);
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   sub cleanup {
@@ -1466,7 +1466,7 @@
       die "Can't find file: $file" unless -e $file;
       unlink $file or die "failed to unlink $file";
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   1;
 
@@ -1555,7 +1555,7 @@
   
       $r->pool->cleanup_register(\&cleanup, $file);
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   sub cleanup {
@@ -1564,7 +1564,7 @@
       die "Can't find file: $file" unless -e $file;
       unlink $file or die "failed to unlink $file";
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   1;
 
@@ -1606,7 +1606,7 @@
 early|docs::1.0::guide::porting/Generating_correct_HTTP_Headers> from
 the handler:
 
-  return Apache2::OK if $r->header_only;
+  return Apache2::Const::OK if $r->header_only;
 
 This logic should not be used in mod_perl 2.0, because Apache 2.0
 automatically discards the response body for HEAD requests. It expects

Modified: perl/modperl/docs/trunk/src/docs/2.0/user/handlers/intro.pod
URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/user/handlers/intro.pod?view=diff&r1=160095&r2=160096
==============================================================================
--- perl/modperl/docs/trunk/src/docs/2.0/user/handlers/intro.pod (original)
+++ perl/modperl/docs/trunk/src/docs/2.0/user/handlers/intro.pod Mon Apr  4 13:38:47 2005
@@ -41,7 +41,7 @@
       $r->content_type('text/plain');
       $r->print("Now is: " . scalar(localtime) . "\n");
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   1;
 
@@ -79,32 +79,32 @@
 value -- things will change in the future and you won't know why
 things aren't working anymore.
 
-The only value that can be returned by all handlers is C<Apache2::OK>,
+The only value that can be returned by all handlers is C<Apache2::Const::OK>,
 which tells Apache that the handler has successfully finished its
 execution.
 
-C<Apache2::DECLINED> is another return value that indicates success,
+C<Apache2::Const::DECLINED> is another return value that indicates success,
 but it's only relevant for
 L<phases|docs::2.0::user::handlers::intro/Stacked_Handlers>
 of type C<L<RUN_FIRST|/RUN_FIRST>>.
 
 L<HTTP handlers|docs::2.0::user::handlers::http> may also return
-C<Apache2::DONE> which tells Apache to stop the normal L<HTTP request
+C<Apache2::Const::DONE> which tells Apache to stop the normal L<HTTP request
 cycle|docs::2.0::user::handlers::http/HTTP_Request_Cycle_Phases> and
 fast forward to the
 C<L<PerlLogHandler|docs::2.0::user::handlers::http/PerlLogHandler>>,
 followed by
 C<L<PerlCleanupHandler|docs::2.0::user::handlers::http/PerlCleanupHandler>>.
 L<HTTP handlers|docs::2.0::user::handlers::http> may return any HTTP
-status, which similarly to C<Apache2::DONE> will cause an abort of the
+status, which similarly to C<Apache2::Const::DONE> will cause an abort of the
 request cycle, by also will be interpreted as an error. Therefore you
-don't want to return C<Apache2::HTTP_OK> from your HTTP response
-handler, but C<Apache2::OK> and Apache will send the C<200 OK> status
+don't want to return C<Apache2::Const::HTTP_OK> from your HTTP response
+handler, but C<Apache2::Const::OK> and Apache will send the C<200 OK> status
 by itself.
 
 L<Filter handlers|docs::2.0::user::handlers::filters> return
-C<Apache2::OK> to indicate that the filter has successfully
-finished. If the return value is C<Apache2::DECLINED>, mod_perl will
+C<Apache2::Const::OK> to indicate that the filter has successfully
+finished. If the return value is C<Apache2::Const::DECLINED>, mod_perl will
 read and forward the data on behalf of the filter. Please notice that
 this feature is specific to mod_perl. If there is some problem with
 obtaining or sending the bucket brigades, or the buckets in it,
@@ -116,12 +116,12 @@
 aren't really handled by Apache, the handler is supposed to take care
 of any errors by itself. The only special case is the
 C<L<PerlPreConnectionHandler|docs::2.0::user::handlers::protocols/PerlPreConnectionHandler>>
-handler, which, if returning anything but C<Apache2::OK> or
-C<Apache2::DONE>, will prevent from
+handler, which, if returning anything but C<Apache2::Const::OK> or
+C<Apache2::Const::DONE>, will prevent from
 C<L<PerlConnectionHandler|docs::2.0::user::handlers::protocols/PerlConnectionHandler>>
 to be
 run. C<L<PerlPreConnectionHandler|docs::2.0::user::handlers::protocols/PerlPreConnectionHandler>>
-handlers should always return C<Apache2::OK>.
+handlers should always return C<Apache2::Const::OK>.
 
 
 
@@ -271,22 +271,22 @@
 
 Handlers of the type C<VOID> will be I<all> executed in the order they
 have been registered disregarding their return values. Though in
-mod_perl they are expected to return C<Apache2::OK>.
+mod_perl they are expected to return C<Apache2::Const::OK>.
 
 =head2 C<RUN_FIRST>
 
 Handlers of the type C<RUN_FIRST> will be executed in the order they
 have been registered until the first handler that returns something
-other than C<Apache2::DECLINED>. If the return value is
-C<Apache2::DECLINED>, the next handler in the chain will be run. If the
-return value is C<Apache2::OK> the next phase will start. In all other
+other than C<Apache2::Const::DECLINED>. If the return value is
+C<Apache2::Const::DECLINED>, the next handler in the chain will be run. If the
+return value is C<Apache2::Const::OK> the next phase will start. In all other
 cases the execution will be aborted.
 
 =head2 C<RUN_ALL>
 
 Handlers of the type C<RUN_ALL> will be executed in the order they
 have been registered until the first handler that returns something
-other than C<Apache2::OK> or C<Apache2::DECLINED>.
+other than C<Apache2::Const::OK> or C<Apache2::Const::DECLINED>.
 
 For C API declarations see I<include/ap_config.h>, which includes
 other types which aren't exposed by mod_perl handlers.

Modified: perl/modperl/docs/trunk/src/docs/2.0/user/handlers/protocols.pod
URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/user/handlers/protocols.pod?view=diff&r1=160095&r2=160096
==============================================================================
--- perl/modperl/docs/trunk/src/docs/2.0/user/handlers/protocols.pod (original)
+++ perl/modperl/docs/trunk/src/docs/2.0/user/handlers/protocols.pod Mon Apr  4 13:38:47 2005
@@ -91,7 +91,7 @@
   sub handler {
       my $c = shift;
       # ...
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
 
 [META: There is another argument passed (the actual client socket), but
@@ -125,10 +125,10 @@
       my $ip = $c->remote_ip;
       if (exists $bad_ips{$ip}) {
           warn "IP $ip is blocked\n";
-          return Apache2::FORBIDDEN;
+          return Apache2::Const::FORBIDDEN;
       }
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   1;
@@ -168,7 +168,7 @@
       my $sock = $c->client_socket;
       $sock->opt_set(APR::SO_NONBLOCK, 0);
       # ...
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
 
 Most likely you'll need to set the socket to perform blocking IO. On
@@ -252,7 +252,7 @@
           $sock->send($buff);
       }
   
-      Apache2::OK;
+      Apache2::Const::OK;
   }
   1;
 
@@ -275,7 +275,7 @@
 
 If the handler receives some data, it sends it unmodified back to the
 client with the C<APR::Socket::send()> method. When the loop is
-finished the handler returns C<Apache2::OK>, telling Apache to
+finished the handler returns C<Apache2::Const::OK>, telling Apache to
 terminate the connection. As mentioned earlier since this handler is
 working directly with the connection socket, no filters can be
 applied.
@@ -351,7 +351,7 @@
       my $last = 0;
       while (1) {
           my $rc = $c->input_filters->get_brigade($bb_in,
-                                                  Apache2::MODE_GETLINE);
+                                                  Apache2::Const::MODE_GETLINE);
           last if $rc == APR::EOF;
           die APR::Error::strerror($rc) unless $rc == APR::SUCCESS;
   
@@ -382,7 +382,7 @@
       $bb_in->destroy;
       $bb_out->destroy;
   
-      Apache2::OK;
+      Apache2::Const::OK;
   }
   
   use base qw(Apache2::Filter);
@@ -395,7 +395,7 @@
           $filter->print(lc $buffer);
       }
     
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   1;
@@ -459,7 +459,7 @@
   
       while (1) {
           my $rc = $c->input_filters->get_brigade($bb,
-                                                  Apache2::MODE_GETLINE);
+                                                  Apache2::Const::MODE_GETLINE);
           last if $rc == APR::EOF;
           die APR::Error::strerror($rc) unless $rc == APR::SUCCESS;
   
@@ -481,7 +481,7 @@
   
       $bb->destroy;
   
-      Apache2::OK;
+      Apache2::Const::OK;
   }
 
 This code is shorter and simpler. Since it sends out the same bucket
@@ -523,7 +523,7 @@
   
       while (1) {
           my $rc = $c->input_filters->get_brigade($bb,
-                                                  Apache2::MODE_GETLINE);
+                                                  Apache2::Const::MODE_GETLINE);
           last if $rc == APR::EOF;
           die APR::Error::strerror($rc) unless $rc == APR::SUCCESS;
   
@@ -532,7 +532,7 @@
   
       $bb->destroy;
   
-      Apache2::OK;
+      Apache2::Const::OK;
   }
 
 Since the simplified handler no longer has the condition:
@@ -566,7 +566,7 @@
   
       while (1) {
           my $rc = $c->input_filters->get_brigade($bb,
-                                                  Apache2::MODE_GETLINE);
+                                                  Apache2::Const::MODE_GETLINE);
           last if $rc == APR::EOF;
           die APR::Error::strerror($rc) unless $rc == APR::SUCCESS;
   
@@ -583,7 +583,7 @@
   
       $bb->destroy;
   
-      Apache2::OK;
+      Apache2::Const::OK;
   }
 
 Notice, that once we slurped the data in the buckets, we had to strip
@@ -646,7 +646,7 @@
       my $c = shift;
       my $socket = $c->client_socket;
   
-      if ((my $rc = login($c)) != Apache2::OK) {
+      if ((my $rc = login($c)) != Apache2::Const::OK) {
           $socket->send("Access Denied\n");
           return $rc;
       }
@@ -659,14 +659,14 @@
           next unless $cmd = getline($socket);
   
           if (my $sub = $commands{$cmd}) {
-              last unless $sub->($socket) == Apache2::OK;
+              last unless $sub->($socket) == Apache2::Const::OK;
           }
           else {
               $socket->send("Commands: @cmds\n");
           }
       }
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   sub login {
@@ -679,7 +679,7 @@
                          run_auth_checker)) {
           my $rc = $r->$method();
   
-          if ($rc != Apache2::OK and $rc != Apache2::DECLINED) {
+          if ($rc != Apache2::Const::OK and $rc != Apache2::Const::DECLINED) {
               return $rc;
           }
   
@@ -694,7 +694,7 @@
           }
       }
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   sub getline {
@@ -723,7 +723,7 @@
       $socket->send(scalar <$fh>);
       close $fh;
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   sub date {
@@ -731,7 +731,7 @@
   
       $socket->send(scalar(localtime) . "\n");
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   sub who {
@@ -742,10 +742,10 @@
   
       $socket->send(scalar `who`);
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
-  sub quit { Apache2::DONE }
+  sub quit { Apache2::Const::DONE }
   
   1;
   __END__
@@ -786,9 +786,9 @@
 C<run_check_user_id()> and C<run_auth_checker()>.  These methods will
 call directly into the Apache functions that invoke module handlers
 for these phases and will return an integer status code, such as
-C<Apache2::OK>, C<Apache2::DECLINED> or C<Apache2::FORBIDDEN>.  If
-I<run_access_check> returns something other than C<Apache2::OK> or
-C<Apache2::DECLINED>, that status will be propagated up to the handler
+C<Apache2::Const::OK>, C<Apache2::Const::DECLINED> or C<Apache2::Const::FORBIDDEN>.  If
+I<run_access_check> returns something other than C<Apache2::Const::OK> or
+C<Apache2::Const::DECLINED>, that status will be propagated up to the handler
 routine and then back up to Apache.  Otherwise, the access check
 passed and the loop will break unless C<some_auth_required()> returns
 true.  This would be false given the previous configuration example,
@@ -824,7 +824,7 @@
 returns just one line of data, with newline characters stripped.  If
 the string sent by the client is in our command table, the command is
 then invoked, otherwise a usage message is sent.  If the command does
-not return C<Apache2::OK>, we break out of the loop.
+not return C<Apache2::Const::OK>, we break out of the loop.
 
 Let's use this configuration:
 

Modified: perl/modperl/docs/trunk/src/docs/2.0/user/handlers/server.pod
URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/user/handlers/server.pod?view=diff&r1=160095&r2=160096
==============================================================================
--- perl/modperl/docs/trunk/src/docs/2.0/user/handlers/server.pod (original)
+++ perl/modperl/docs/trunk/src/docs/2.0/user/handlers/server.pod Mon Apr  4 13:38:47 2005
@@ -80,25 +80,25 @@
       my $oldfh = select($log_fh); $| = 1; select($oldfh);
   
       say("process $$ is born to reproduce");
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   sub post_config {
       my($conf_pool, $log_pool, $temp_pool, $s) = @_;
       say("configuration is completed");
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   sub child_init {
       my($child_pool, $s) = @_;
       say("process $$ is born to serve");
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   sub child_exit {
       my($child_pool, $s) = @_;
       say("process $$ now exits");
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   
   sub say {
@@ -238,7 +238,7 @@
       my $oldfh = select($log_fh); $| = 1; select($oldfh);
   
       say("process $$ is born to reproduce");
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
 
 In our example the handler opens a log file for appending and sets the
@@ -265,7 +265,7 @@
           my $port = $vs->port;
           warn "vhost port: $port\n";
       }
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
 
 C<$s> is the base server object.
@@ -327,7 +327,7 @@
   sub post_config {
       my($conf_pool, $log_pool, $temp_pool, $s) = @_;
       say("configuration is completed");
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
 
 As you can see, its arguments are identical to the
@@ -379,7 +379,7 @@
   sub child_init {
       my($child_pool, $s) = @_;
       say("process $$ is born to serve");
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
 
 The I<child_init()> handler accepts two arguments: the child process
@@ -415,7 +415,7 @@
   sub child_exit {
       my($child_pool, $s) = @_;
       say("process $$ now exits");
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
 
 The I<child_exit()> handler accepts two arguments: the child process

Modified: perl/modperl/docs/trunk/src/docs/2.0/user/intro/start_fast.pod
URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/user/intro/start_fast.pod?view=diff&r1=160095&r2=160096
==============================================================================
--- perl/modperl/docs/trunk/src/docs/2.0/user/intro/start_fast.pod (original)
+++ perl/modperl/docs/trunk/src/docs/2.0/user/intro/start_fast.pod Mon Apr  4 13:38:47 2005
@@ -154,7 +154,7 @@
       $r->content_type('text/plain');
       print "mod_perl 2.0 rocks!\n";
   
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
   1;
 

Modified: perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod
URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod?view=diff&r1=160095&r2=160096
==============================================================================
--- perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod (original)
+++ perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod Mon Apr  4 13:38:47 2005
@@ -403,13 +403,13 @@
   
   sub handler {
       # ...
-      return MP2 ? Apache2::OK : Apache::Constants::OK;
+      return MP2 ? Apache2::Const::OK : Apache::Constants::OK;
   }
   1;
 
 Notice that if you don't use the idiom:
 
-      return MP2 ? Apache2::OK : Apache::Constants::OK;
+      return MP2 ? Apache2::Const::OK : Apache::Constants::OK;
 
 but something like the following:
 
@@ -419,7 +419,7 @@
   }
   sub handler2 {
       ...
-      return Apache2::OK();
+      return Apache2::Const::OK();
   }
 
 You need to add C<()>. If you don't do that, let's say that you run
@@ -569,7 +569,7 @@
   sub handler {
     print "Content-type: text/plain\n\n";
     print "Hello";
-    return Apache2::OK;
+    return Apache2::Const::OK;
   }
 
 where the C<handler()> function always receives C<$r> as an argument,
@@ -598,7 +598,7 @@
           print "Content-type: text/plain\n\n";
       }
       print "Hello"
-      return Apache2::OK;
+      return Apache2::Const::OK;
   }
 
 The script works under both mod_perl and mod_cgi.
@@ -973,7 +973,7 @@
   sub cleanup_callback {
       my($pool, $s) = @_;
       # your code comes here
-      Apache2::OK;
+      Apache2::Const::OK;
   }
   $s->push_handlers(PerlChildExitHandler => \&my_access);
 

Modified: perl/modperl/docs/trunk/src/docs/2.0/user/porting/porting.pod
URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/user/porting/porting.pod?view=diff&r1=160095&r2=160096
==============================================================================
--- perl/modperl/docs/trunk/src/docs/2.0/user/porting/porting.pod (original)
+++ perl/modperl/docs/trunk/src/docs/2.0/user/porting/porting.pod Mon Apr  4 13:38:47 2005
@@ -987,7 +987,7 @@
    use Socket 'sockaddr_in';
 
 and I also had to adjust the constants, since what used to be C<OK>,
-now has to be C<Apache2::OK>, mainly because in mod_perl 2.0 there is
+now has to be C<Apache2::Const::OK>, mainly because in mod_perl 2.0 there is
 an enormous amount of constants (coming from Apache and APR) and most
 of them are grouped in C<Apache2::> or C<APR::> namespaces. The
 C<L<Apache2::Const|docs::2.0::api::Apache2::Const>> and
@@ -1014,7 +1014,7 @@
        my $mime = $self->r->lookup_file("$dir/$d")->content_type;
   
   -    push(@directories,$d) if !$seen{$d}++ && $mime eq DIR_MAGIC_TYPE;
-  +    push(@directories,$d) if !$seen{$d}++ && $mime eq Apache2::DIR_MAGIC_TYPE;
+  +    push(@directories,$d) if !$seen{$d}++ && $mime eq Apache2::Const::DIR_MAGIC_TYPE;
   
        # .m3u files should be configured as audio/playlist MIME types in your apache .conf file
        push(@playlists,$d) if $mime =~ m!^audio/(playlist|x-mpegurl|mpegurl|x-scpls)$!;
@@ -1112,7 +1112,7 @@
   
   -  $self->r->send_http_header( $self->html_content_type );
   +  $self->r->content_type( $self->html_content_type );
-     return Apache2::OK if $self->r->header_only;
+     return Apache2::Const::OK if $self->r->header_only;
   
      print start_html(
   @@ -336,7 +336,7 @@
@@ -1121,22 +1121,22 @@
   
   -  $r->send_http_header('audio/mpegurl');
   +  $r->content_type('audio/mpegurl');
-     return Apache2::OK if $r->header_only;
+     return Apache2::Const::OK if $r->header_only;
   
      # local user
   @@ -495,7 +495,7 @@
-     return Apache2::DECLINED unless my ($directories,$mp3s,$playlists,$txtfiles)
+     return Apache2::Const::DECLINED unless my ($directories,$mp3s,$playlists,$txtfiles)
        = $self->read_directory($dir);
   
   -  $self->r->send_http_header( $self->html_content_type );
   +  $self->r->content_type( $self->html_content_type );
-     return Apache2::OK if $self->r->header_only;
+     return Apache2::Const::OK if $self->r->header_only;
   
      $self->page_top($dir);
 
 also I've noticed that there was this code:
 
-  return Apache2::OK if $self->r->header_only;
+  return Apache2::Const::OK if $self->r->header_only;
 
 This technique is no longer needed in 2.0, since Apache 2.0
 automatically discards the body if the request is of type C<HEAD> --
@@ -1174,7 +1174,7 @@
   -      close(FILE);
   +
   +    if($r->content_type eq 'audio/x-scpls'){
-  +      $r->sendfile($r->filename) || return Apache2::NOT_FOUND;
+  +      $r->sendfile($r->filename) || return Apache2::Const::NOT_FOUND;
 
 =item C<log_reason>
 
@@ -1347,7 +1347,7 @@
      MP2 ? $r->content_type('text/plain')
          : $r->send_http_header('text/plain');
      print "$class was called\n";
-     return MP2 ? Apache2::OK : Apache::Constants::OK;
+     return MP2 ? Apache2::Const::OK : Apache::Constants::OK;
   }
 
 Here are two complete examples. The second example implements
@@ -1410,7 +1410,7 @@
       my($class, $r) = @_;
       $r->content_type('text/plain');
       $r->print("mp2: $class was called\n");
-      return Apache2::OK();
+      return Apache2::Const::OK();
   }
 
 Assuming that mod_perl 1.0 is listening on port 8001 and mod_perl 2.0



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