On Sat, 11 Sep 2004 17:01:15 +0200, Sebastian Riedel wrote
> Simon Flack:
[snip]
> > $r->cookie();
> > $r->header();
> > $r->param(...);
> >
> >with cookie() and header() being Class::Data::Inheritable hashes of CGI::
> >Cookie objects and header strings.
> >
> >Just a thought.
> >
> >
> Maybe it's best to make it separate CPAN modules, Maypole::Cookie,
> Maypole::Header...
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');
$r->cookie()->{foo} = CGI::Cookie->new(-name => 'foo' -value => 'bar');
my $user_prefs = $r->cookie()->{user_prefs};
print $user_prefs->value;
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().
--simonflk
_______________________________________________
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