William McKee wrote:
On Fri, Oct 22, 2004 at 11:25:34AM -0400, Michael wrote:

Well then, should I add this by trying to duplicate the C::A code if there is no $ENV{MOD_PERL} or should I just call $self->SUPER::cgiapp_get_query or $self->SUPER::_send_headers? Since the plugin exports these methods to the application class then it should work just fine and then C::A could actually change without me having to worry.


Thinking out loud here.... Would it be possible to avoid exporting these
functions if it's detected that we are not in a mod_perl environment?
Would a BEGIN block be sufficient (or even necessary)?

  use vars qw(@EXPORT_OK %EXPORT_TAGS);
  BEGIN {
    if ($ENV{MOD_PERL}) {
      @EXPORT_OK = qw(handler cgiapp_get_query _send_headers);
      %EXPORT_TAGS = (all => [EMAIL PROTECTED]);
    }
  }

That actually seems like a really good idea to me. Save me a lot of if/else stuff.


I'm not sure if this implementation would cause problems if some scripts
are run under mod_cgi and some under mod_perl on the same server. I
guess it depends on whether the module would be reloaded when run in the
different environments or whether the mod_cgi scripts would share the
same modules loaded by the mod_perl scripts. I would hope these
environments would be seperate.

I don't think this would conflict at all. All requests under mod_perl share the same interpreter with the same modules loaded but each cgi request generates a new interpreter which will have to load the modules for itself.


Also, should we look at making _send_headers into send_headers in case other modules want to subclass this behaviour as well?


If you referring to the sub in C::A, it does seem a bit unfriendly to be
overriding a private subroutine. I'd vote for making it public.

well if it's a private sub then we should make it public, but if we want to think of it as a 'protected' sub then all derived classes, etc should be able to see, just not things using those classes. It just depends on how we want to look it... That being said I vote for making it public.


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