On Fri, Oct 22, 2004 at 03:46:21PM -0400, Michael wrote:
> Ok, here's another stab at this. I've include a test application module
> that I've been using to make sure stuff works together. Please look at
> the code, docs, test, etc and see if there is anything I might have left
> out.
Nice work, Michael. Those subroutines which do the header conversion are
indeed a bear. I've made some comments in the POD and attached a diff.
I'm interested to get your feedback on them.
If you put this into a distribution, I'd be willing to help get testing
in place using Apache::Test[1].
William
[1] http://perl.apache.org/docs/general/testing/testing.html
--
Knowmad Services Inc.
http://www.knowmad.com
--- Apache.pm.orig 2004-10-22 16:16:53.000000000 -0400
+++ Apache.pm 2004-10-22 16:35:37.000000000 -0400
@@ -395,7 +395,7 @@
But it's really up to you.
-=head1 MISC
+=head1 COMPATIBILITY
Upon using this module you completely leave behind the world of L<CGI.pm|CGI>. Don't
look back or
you might turn into a pillar of salt. You will have to look at and read the docs of
the Apache::*
@@ -405,7 +405,30 @@
If you are trying to use this module but don't want to have to change your previous
code that
uses C<< header_props() >> or C<< header_add() >> then we try to help you out by
being as CGI
compatible as we can, but it is always better to use the mod_perl api. If you still
want to use
-C<< header_props() >> or C<< header_add() >> remeber that it will cause a performance
hit.
+C<< header_props() >> or C<< header_add() >> remember that it will cause a
performance hit because
+these helper routines from L<CGI::Application> use L<CGI.pm|CGI>.
+
+If you wish to write code that performs well in both environments, you can check the
$ENV{MOD_PERL}
+environment setting and branch accordingly. For example, to set a cookie:
+
+ if ($ENV{MOD_PERL}) {
+ require Apache::Cookie;
+ $cookie = Apache::Cookie->new(
+ $q,
+ -name => 'favorite',
+ -value => 'chocolate chip',
+ -expires => '+2h',
+ );
+ $cookie->bake;
+ }
+ else {
+ $cookie = $self->query->cookie(
+ -name => 'favorite',
+ -value => 'chocolate chip',
+ -expires => '+2h',
+ );
+ $webapp->header_add(-cookie => [$cookie]);
+ }
If for some reason you are using this plugin in a non-mod_perl environment, it will
try to
do the right thing by simply doing nothing :)
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]