William McKee wrote:
On Fri, Oct 22, 2004 at 10:16:17AM -0400, Michael wrote:

I can have my plugin set the CGIAPP_PLUGIN_APACHE environment variable. Then any other plugins can see that and act accordingly. For instance, you could check for this env var before setting a cookie to either use CGI.pm's cookie() or use Apache::Cookie(). Then you could either use header_add() or query->header_out() to add it. Thoughts?


Hmm, I don't like the idea of setting environment values--seems like it
could get messy. Why can't C::A::P::Cookie check the type of object that
it gets from $self->query and behave accordingly?

This would work if you could assume that since the query object is an Apache::Request object that the user wants to send their HTTP headers using query->header_out() as opposed to header_add(). But this isn't the case. If they are using Apache::Request for their query object, but aren't using my plugin for headers then trying to guess like that causes problems if they decide to use header_add().


But then again, there still exists a similar problem when they only import portions of my plugin or when they use my plugin but still use header_add(). If the session plugin tried to use query->header_out() and the user uses header_add() then it would still clobber the cookie.

hmmm. maybe I should look into trying to duplicate CGI::header in my plugin so that it would work with previous query->header_out() calls... I just see this as being nightmare to maintain CGI compatibility...

This might actually be a way for all plugins to communicate with each other. We had a previous discussion about whether some plugins might want to be able to detect if others where there. For instance, an auth and session plugin. Other thoughts?


I don't have any other bright ideas so setting an environment variable
may be sufficient. However, in cases like this one, it seems far more
effective to use data on hand instead of adding complexity to our
applications.

I just don't think that checking the type of the query object is a completely reliable way to see how they want to send headers.


Maybe headers need a further abstraction in the C::A code. Any ideas?

--
Michael Peters
Developer
Plus Three, LP


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



Reply via email to