You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Justin Wheeler <jw...@datademons.com> on 2005/08/09 17:44:18 UTC

[MP2] mod_perl 1.0 -> mod_perl 2.0 conversion woes.

I realise there's a good chance my issue is my own stupidity, but I'm
hoping someone else can help out -- I've searched this mailing list and
google, all to no avail.

I am in the midst of trying to convert my software from mod_perl 1 to
mod_perl 2 without the use of Apache2::Compat.

I have imported (I think) all of the necessary modules, and changed the
constants to read Apache2::Const::OK|DECLINED|etc.

I have made the necessary conversions in the code, etc.

My Apache config simply reads:

PerlResponseHandler deBiz::Main

So when I fetch a URL, it calls deBiz::Main::handler just fine.

My code works by doing what it must do, and then doing a push_handlers
to move onto the next function, that way, any given part of the module
can return something other than DECLINED and it will quit at that point.

It all worked just fine in mod_perl 1.0

The functions it calls in order are:

handler -> dbconnect -> session_check -> prepare_data -> sendpage

And it works by calling:

Apache2::ServerUtil->server->push_handlers('PerlResponseHandler' =>
\&functionname);

So, the program runs on index.html, and works just fine.. it calls each
function perfectly in order as it's supposed to.

Then, when anything referenced by the page (ie an image, or favicon.ico)
is requested in the same HTTP session by the browser, mod_perl tries to
parse it by starting over at &dbconnect() instead of going back to the
original &handler().

Even if I set a variable and look for its value in dbconnect and reset
handler and return DECLINED, it just ends and refuses to run &handler().

As I said before, it works just fine in mod_perl 1.0, and only broke as
of mod_perl 2.0.

Thoughts/ideas?
Justin

Re: [MP2] mod_perl 1.0 -> mod_perl 2.0 conversion woes.

Posted by Justin Wheeler <jw...@datademons.com>.
Yup.  As it turns out, it was my own stupidity.  It was calling handler
again, but handler was returning DECLINED due to a mismatched
content_type, and mod_perl had simply remembered the next handler was
dbconnect and went about its day.

Problem was fixed by having handler() clear out any other
PerlResponseHandlers before starting over again.

Justin

Justin Wheeler wrote:
> I realise there's a good chance my issue is my own stupidity, but I'm
> hoping someone else can help out -- I've searched this mailing list and
> google, all to no avail.
> 
> I am in the midst of trying to convert my software from mod_perl 1 to
> mod_perl 2 without the use of Apache2::Compat.
> 
> I have imported (I think) all of the necessary modules, and changed the
> constants to read Apache2::Const::OK|DECLINED|etc.
> 
> I have made the necessary conversions in the code, etc.
> 
> My Apache config simply reads:
> 
> PerlResponseHandler deBiz::Main
> 
> So when I fetch a URL, it calls deBiz::Main::handler just fine.
> 
> My code works by doing what it must do, and then doing a push_handlers
> to move onto the next function, that way, any given part of the module
> can return something other than DECLINED and it will quit at that point.
> 
> It all worked just fine in mod_perl 1.0
> 
> The functions it calls in order are:
> 
> handler -> dbconnect -> session_check -> prepare_data -> sendpage
> 
> And it works by calling:
> 
> Apache2::ServerUtil->server->push_handlers('PerlResponseHandler' =>
> \&functionname);
> 
> So, the program runs on index.html, and works just fine.. it calls each
> function perfectly in order as it's supposed to.
> 
> Then, when anything referenced by the page (ie an image, or favicon.ico)
> is requested in the same HTTP session by the browser, mod_perl tries to
> parse it by starting over at &dbconnect() instead of going back to the
> original &handler().
> 
> Even if I set a variable and look for its value in dbconnect and reset
> handler and return DECLINED, it just ends and refuses to run &handler().
> 
> As I said before, it works just fine in mod_perl 1.0, and only broke as
> of mod_perl 2.0.
> 
> Thoughts/ideas?
> Justin