perl-docs-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject cvs commit: modperl-docs/src/docs/2.0/user/coding cooking.pod
Date Tue, 12 Aug 2003 17:31:16 GMT
geoff       2003/08/12 10:31:16

  Modified:    src/docs/2.0/user/coding cooking.pod
  Log:
  create separate Registry and handler cookie setting recipes
  Submitted by:	geoff
  
  Revision  Changes    Path
  1.2       +30 -3     modperl-docs/src/docs/2.0/user/coding/cooking.pod
  
  Index: cooking.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/coding/cooking.pod,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- cooking.pod	10 Aug 2003 19:07:13 -0000	1.1
  +++ cooking.pod	12 Aug 2003 17:31:16 -0000	1.2
  @@ -11,13 +11,13 @@
   L<the mod_perl mailing list|maillist::modperl> and we will add it
   here.
   
  -=head1 Sending Cookies in REDIRECT Response
  +=head1 Sending Cookies in REDIRECT Response (ModPerl::Registry)
   
     use CGI::Cookie ();
     use Apache::RequestRec ();
     use APR::Table ();
     
  -  use Apache::Const -compile => qw(REDIRECT OK);
  +  use Apache::Const -compile => qw(REDIRECT);
     
     my $location = "http://example.com/final_destination/";
     
  @@ -31,12 +31,39 @@
         $r->headers_out->set(Location => $location);
         $r->status(Apache::REDIRECT);
     
  -      return Apache::OK;
  +      return Apache::REDIRECT;
     }
     1;
   
   
  +=head1 Sending Cookies in REDIRECT Response (handlers)
   
  +  use CGI::Cookie ();
  +  use Apache::RequestRec ();
  +  use APR::Table ();
  +  
  +  use Apache::Const -compile => qw(REDIRECT);
  +  
  +  my $location = "http://example.com/final_destination/";
  +  
  +  sub handler {
  +      my $r = shift;
  +  
  +      my $cookie = CGI::Cookie->new(-name  => 'mod_perl',
  +                                    -value => 'awesome');
  +  
  +      $r->err_headers_out->add('Set-Cookie' => $cookie);
  +      $r->headers_out->set(Location => $location);
  +  
  +      return Apache::REDIRECT;
  +  }
  +  1;
  +
  +note that this example differs from the Registry example
  +only in that it does not attempt to fiddle with 
  +C<$r->status()> - C<ModPerl::Registry> uses C<$r->status()>
  +as a hack, but handlers should never manipulate the
  +status field in the request record.
   
   
   =head1 Maintainers
  
  
  

---------------------------------------------------------------------
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