[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] Re: CAP::Apache and CAP::Session


Mark Stosberg wrote:
A proposed solution would be to modify CAP::Session to either check the type of object that $query is and only use the cookie() method if it's CGI.pm, else use CGI::Cookie since that's what CGI uses under the hood anyway) or it could even check to see if the $ENV{MOD_PERL} is set and if it is, use Apache::Cookie, else use CGI::Cookie.


Using CGI::Cookie sounds like it makes sense in any case.

- Those who use CGI.pm will already have it.

- Those who prefer to avoid CGI.pm won't have to load the whole thing.
  OTOH, under mod_perl, I can't see it making much difference. You
  have to install CGI.pm to get CGI::Cookie (right?) and there shouldn't
  be much performance penalty if CGI.pm is in memory already and just
passes back and forth with CGI::Cookie.

Using CGI::Cookie will not load CGI.pm into memory. It's correct that you have to have it installed on your system (since it uses the CGI::Util package that comes with CGI.pm), but perl comes with CGI anyway right ? Just because it's on your system doesn't mean apache loads it into memory under mod_perl.

From the CGI::Cookie docs

    Although CGI::Cookie is intended to be used in conjunction with
    CGI.pm (and is in fact used by it internally), you can use this
    module independently.

So there is a performance increase in using CGI::Cookie without CGI.pm under mod_perl

Another idea: see if the query object has a cookie method instead of
checking the package name, making  that part of the solution more
general.

Your right that could work. But you'd still need to use something else if the cookie method doesn't exist. Which probably means CGI::Cookie. So why perform the check at all? Since if it does have a cookie() method you call that which ends up loading and using CGI::Cookie or you simply load and use CGI::Cookie itself. I don't really see the benefit of checking if you're going to use CGI::Cookie regardless.

--
Michael Peters
Developer
Plus Three, LP


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.