Re: [Maypole] Maypole::Utils for portability

From: Sebastian Riedel (sri at oook.de)
Date: Sat Sep 11 2004 - 18:36:14 BST


Simon Flack:

>
>We could do, but I don't think we need to reinvent tested modules that are
>already on CPAN. Despite being in the CGI:: namespace, CGI::Cookie isn't
>dependent on CGI or mod_perl or any other environment. A new maypole provider
>just needs to create CGI::Cookie objects or do nothing if cookies aren't
>available. We could also use HTTP::Headers to represent the output headers.
>
>I've attached a patch to demonstrate. It's untested, but should work like
>this:
>
> $r->headers->content_type('text/plain');
> $r->headers->expires(...);
> $r->headers->header('X-Bender', 'kiss my shiny metal ass');
>
I like it, but how would you handle input headers?

> $r->cookie()->{foo} = CGI::Cookie->new(-name => 'foo' -value => 'bar');
> my $user_prefs = $r->cookie()->{user_prefs};
> print $user_prefs->value;
>
>
Having to type foo twice is a liddle bit annoying and incoming cookies
will also be send out.

>The headers() object and cookie() hash is initialised by Maypole.pm in
>handler(). So maypole providers just need to populate cookies() if applicable,
>and handle the headers and cookies in send_output().
>
>
but looks like a good start...

sebastian

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:56 GMT