Re: Can anyone recommend a good flavour of Cookie?

2002-03-07 Thread Geoffrey Young

Jeff wrote:
 
 Please forgive a mod_perl wannabie [aka woza.PHP4.user]
 
 I have googled two differing flavoured cookies in the
 mod_perl recipe library:
   Apache::Cookie

Apache::Cookie is a nice interface for cookies that is specific to the mod_perl 
environment.  it
parallels CGI::Cookie, except it is a C implementation so is a bit faster

   Apache::RequestNotes

is a wrapper around Apache::Cookie (among other things)

 
 and of course, there is the 'Why not hack the HTTP_COOKIE
 env all by your lonesome?' peppermint flavour too!

eeew, don't do that.  the whole point of Apache::Cookie, CGI::Cookie (and CPAN in 
general) is to
abstract out these things into modular components that are tried and true.  using 
Apache::Request or
CGI.pm for parsing GET and POST parameters (instead of reading from STDIN or 
$ENV{QUERY_STRING}) is
also the preferred way.

Recipes 3.5 and 3.7 in the mod_perl cookbook should be of some help.

welcome to mod_perl!  :)

--Geoff
plug
http://www.modperlcookbook.org/
/plug



Re: Can anyone recommend a good flavour of Cookie?

2002-03-07 Thread Robert Landrum

At 9:28 AM + 3/7/02, Jeff wrote:
Please forgive a mod_perl wannabie [aka woza.PHP4.user]

I have googled two differing flavoured cookies in the
mod_perl recipe library:
  Apache::Cookie
  Apache::RequestNotes

and of course, there is the 'Why not hack the HTTP_COOKIE
env all by your lonesome?' peppermint flavour too!

So which is it folks? Please vote for your favourite
flavour of cookie for poor woza.PHP4.user


Actually, I always roll my own...  I can't stand those Apache::Cookie 
and CGI::Cookie modules... they never seem to work the way I expect 
them to.

Plus, decoding cookies is easy.

my %cookies = map {
s/\%([A-F0-9]{2})/chr(hex($1))/eg;  split(/=/,$_,2);
} (split(/\/,$ENV{'HTTP_COOKIE'}));

Rob

--
When I used a Mac, they laughed because I had no command prompt. When 
I used Linux, they laughed because I had no GUI.