Practical mod_perlPractical mod_perlSearch this book

Appendix A. mod_perl Recipes

Contents:

Emulating the Authentication Mechanism
Reusing Data from POST Requests
Redirecting POST Requests
Redirecting While Maintaining Environment Variables
Handling Cookies
Sending Multiple Cookies with the mod_perl API
Sending Cookies in REDIRECT Responses
CGI::params in the mod_perlish Way
Sending Email from mod_perl
mod_rewrite in Perl
Setting PerlHandler Based on MIME Type
Singleton Database Handles
Terminating a Child Process on Request Completion
References

This appendix acts as a mini-cookbook for mod_perl. As we've mentioned many times in this book, the mod_perl mailing list is a terrific resource for anyone working with mod_perl. Many very useful code snippets and neat techniques have been posted to the mod_perl mailing list. In this appendix, we present the techniques that you will find most useful in your day-to-day mod_perl programming.

A.1. Emulating the Authentication Mechanism

You can authenticate users with your own mechanism (instead of the standard one) but still make Apache think that the user was authenticated by the standard mechanism. Set the username with:

$r->connection->user('username');

Now you can use this information, for example, during logging, so that you can have your "username" passed as if it was transmitted to Apache through HTTP authentication.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.