[Maypole] (no subject)

Simon Flack sf@flacks.net
Fri, 19 Nov 2004 12:48:32 +0000


On Fri, 19 Nov 2004 10:21:27 +0100, Sebastian Riedel wrote
> Funny, in Catalyst we have split the Maypole Request in Context, 
> Request and Response.
> 
> Some examples:
> 
> Context:
> $c->config->{foo};
> $c->get_request;
> $c->objects->{foo} = { bar => 'yada' };
> $c->trunk->{template} = 'view';
> $c->session->{persistent} = 'foo';
> $c->encode_uri('http://localhost/petstore/index.html?foo=bar'); # 
> (rewrites the given uri with sessionid if needed, so result is 
> http://localhost/petstore/index.html?foo=bar&sessionid=123)
> ...
> 
> Request (part of the context):
> $c->request->headers->header('X-Bender'); # (it's a HTTP::Headers 
> object)
> $c->request->cookies->{sessionid}->value; # (it's a CGI::Cookie or 
> Apache::Cookie object)
> $c->request->parameters->{foo};
> $c->request->arguments->[0];
> $c->request->action;
> ...
>
> Response (part of the context):
> $c->response->headers->header('X-Bender' => 'Kiss my shiny metal 
> ass'); 
> # (HTTP::Headers object)
> $c->response->headers->content_type('text/yaml-1.0');
> $c->response->cookies->{sessionid} = { value => '123', expires => 
> '+3m' }; # (Can be an CGI::Cookie, Apache::Cookie object or just a 
> hashref) $c->response->output('Hello Maypole! :P'); $c->response-
> >status(404); $c->response->redirect('http://maypole.perl.org'); ...

That is very similar to what I have in mind for Maypole. But I don't think we
need that separation - one request object should be enough. I don't think we
need that complexity, but I think I understand why you need it for Catalyst.
Can you use custom context/request/response objects?

> And you've managed to completely miss one point, Debugging!
> Maypole needs to throw much more warnings and more verbose error 
> messages, debugging Maypole apps is horrible at the moment.
> Thats one of the main reasons i rewrote nearly all internals for 
> Catalyst.

Yep. I'm going to add a lot of tracing, but the output will be configurable. I
think I'll be using Log::Trace when it's released:
    http://www.perlmonks.org/?node_id=403052

--simonflk