You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axkit-dev@xml.apache.org by Sean McMurray <sm...@cpan.org> on 2003/10/31 23:26:20 UTC

ContentProvider invoked twice per request

I've noticed that perl CGI scripts that are executed through the 
Apache::AxKit::Provider::CGI ContentProvider don't have access to the 
query string params. Using CGI, etc. returns blank.

So I figured I would capture them in the Provider, and pass them into 
the CGI script.

While implementing this, I found that the get_strref() sub in my 
Provider is getting called twice. The first time through, $self is an 
Apache object, and the params get passed into the CGI script just right. 
The second time through, $self is an AxKit::Apache object, and things 
break down.

Why is it called twice? That seems very inefficient. And why is it a 
different class each time? What have I missed?


Re: ContentProvider invoked twice per request

Posted by Mike Chamberlain <mi...@btinternet.com>.
On Friday, October 31, 2003, at 10:26  pm, Sean McMurray wrote:

> I've noticed that perl CGI scripts that are executed through the 
> Apache::AxKit::Provider::CGI ContentProvider don't have access to the 
> query string params. Using CGI, etc. returns blank.
>
> So I figured I would capture them in the Provider, and pass them into 
> the CGI script.
>
> While implementing this, I found that the get_strref() sub in my 
> Provider is getting called twice. The first time through, $self is an 
> Apache object, and the params get passed into the CGI script just 
> right. The second time through, $self is an AxKit::Apache object, and 
> things break down.
>
> Why is it called twice? That seems very inefficient. And why is it a 
> different class each time? What have I missed?
>
>

You've not missed anything, it's a bug (or a feature :).

What's happening internally is that AxKit has to sniff the content 
generated from the provider
to work out what styles it needs to apply. The bug is that it should 
store this content that it's
read and reuse it, at the moment it goes back to the provider and asks 
for it again.

The seconds read is the data being passed to the pipeline.

You've also highlighted a second buglet, which is the differently 
blessed $r.

The AxKit::Apache object is a reblessed apache object which captures 
any output to STDOUT
and buffers it up, allowing it to be passed to the next item in the 
pipeline. If your making
content from a CGI, it would make sense that the first $r is reblessed 
as well, since CGI's
like to call print. I'm working on some new development code which will 
fix these issues
in later releases of axkit, if possible I'll look at back porting any 
fixes.

Mike.