Re: New to ModPerl 2

[prev] [thread] [next] [Date index for 2004/11/14]

From: Kurt Hansen
Subject: Re: New to ModPerl 2
Date: 21:05 on 14 Nov 2004
Markus Wichitill wrote:

> jonathan vanasco wrote:
>
>> In mod_perl1, I have a handler that takes an apache request object 
>> manipulates the cookie/session data into a user, then presents the 
>> user with a page
>>
>> in mod_perl2, however, there is no Apache::Request (yet) -- so my 
>> code simply doesn't work at all. 
>
>
> Apache::Request 2.0 (libapreq2), like mod_perl 2.0, is officially 
> still in development, but mostly done.
>
> http://httpd.apache.org/apreq/

I second the advice to use libapreq2 if your code is based on libapreq1. 
I'm almost done with the conversion.

Note, though, that libapreq2 will require some changes in your code, but 
probably less than not using libapreq. Be sure to read the 
documentation, especially the notes about converting from v1, for 
Apache::Request and Apache::Cookie at:

http://httpd.apache.org/apreq/docs/libapreq2/modules.html

A few things that caused me more pain than I care to admit:

1. Apache::Cookie v2 requires an Apache::RequestRec environment variable 
instead of an Apache::Request variable. Using the latter caused a 
segmentation fault. I believe $r in modperl2 is an Apache::RequestRec 
object, so just using your old code call should work fine. I, however, 
use HTML::Mason v1.27 which converted $r into an Apache::Request object 
which caused me much confusion.

2. Name and Value of a cookie cannot be changed. You'll have to create a 
new Apache::Cookie if you want to change either.

3. Expires method works differently between v1 and v2 of 
Apache::Cookie->new. An empty variable for -expires will default to 
"now" in v2 which means the cookie won't be set since it expires 
immediately. In v1,  an empty -expires created a session cookie. To get 
the same behavior in v2, just don't supply an -expires parameter in new.

Take care,

Kurt Hansen
khansen@xxxxxxxxxx.xxx

        -- 
        Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

(message missing)

New to ModPerl 2
jonathan vanasco 19:26 on 14 Nov 2004

Re: New to ModPerl 2
Markus Wichitill 19:46 on 14 Nov 2004

Re: New to ModPerl 2
Kurt Hansen 21:05 on 14 Nov 2004

Re: New to ModPerl 2
Joe Schaefer 16:18 on 15 Nov 2004

Re: New to ModPerl 2
jonathan vanasco 05:51 on 16 Nov 2004

Re: New to ModPerl 2
Joe Schaefer 13:31 on 16 Nov 2004

Re: New to ModPerl 2
Kurt Hansen 21:06 on 14 Nov 2004

Re: New to ModPerl 2
Dan Brian 00:04 on 15 Nov 2004

Re: New to ModPerl 2
jonathan vanasco 00:42 on 15 Nov 2004

Re: New to ModPerl 2
jonathan vanasco 00:04 on 15 Nov 2004

Re: New to ModPerl 2
Jonathan Vanasco 16:21 on 16 Nov 2004

Re: New to ModPerl 2
Stef1 17:30 on 16 Nov 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52