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

Re: [cgiapp] CGI::Application::Dispatch and FastCGI


David Steinbrunner wrote:

> My current work around is to simply disable the caching by commenting out the
> $self->_url_cache(suppressed) line.
> 
> I'm noticing FCGI_ROLE is an ENV var that could be used to create a constant
> similar to the IS_MODPERL constant and then what ever magic is needed could be
> key off that.  I might be able to figure out the magic but I don't have time
> for it this evening.

Turns out the FCGI_ROLE ENV is not available at the point Dispatch sets up
the constants and I'm not seeing something to replace it.  To make my
modifications slightly better I changed the
$self->_url_cache(suppressed) line from being commented out to
having an unless $ENV{FCGI_ROLE} trail it, hence it looked like:

    # Cache this URL - dispatch map for later use.
    $self->_url_cache(suppressed) unless $ENV{FCGI_ROLE};

In an effort to figure out more about the reasoning of the caching I started
looking over the docs more and found the PROTECTED METHODS section that
talks about the _get_cache and _set_cache methods.  At that point I had the
bright idea of sub classing them so that I could get my code out of
CGI::Application::Dispatch and into my own Dispatch subclass that is already
overriding http_error.  That did not go so hot since neither _get_cache or
_set_cache ever get called.  Looks like _url_cache has replaced the above
methods and the docs never updated to reflect that change.

I now have _url_cache overridden with basically an empty method.  Looking at
the data structure that is being passed to the method I see it is an array
with the App name, runmode name and then a hash with the QUERY and PARAMS of
the request, QUERY having data and PARAMS not having data. If you look at
how caching is being handled for mod_perl, the PARAMS bit of the hash is
always being replaced.  If you are running in a straight CGI environment,
the cache will not stick round for the next request so caching would be a
good thing to skip.

To dig a bit deeper I decided to setup my simple system to work under Apache
1.3.x and Apache::Registry to see what is going on with _url_cache when
mod_perl is being used.  I found that the PARAMS is present but empty and
that is it.

I have not tested with pure mod_perl yet but it would seem that the caching
system needs some changes or rethinking.  It is quite possible I might be
missing something, so please enlighten me if that is the case.

Thanks,

--
David Steinbrunner



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