Re: [Maypole] Todo

From: Simon Flack (sf at flacks.net)
Date: Mon Sep 06 2004 - 19:18:43 BST


On Mon, 6 Sep 2004 18:59:18 +0100, Simon Cozens wrote
> Simon Flack:
> > But not for param(). param() IMO, should call $r->get_request->param(). That'd
> > work at least for Apache::MVC and CGI::Maypole. You'd probably need something
> > cleverer for Maypole::CLI.
>
> Huh? No, I think you misunderstand.
>
> The intention was that a Maypole request should be a superset of an
> Apache::Request or equivalent. It should encapsulate everything you
> need to know about the journey of a request from the browser to
> Maypole and out through the view class and the frontend. The
> parameters and arguments are no longer Apache or CGI parameters and
> arguments - they are Maypole parameters and arguments. You don't
> need to care where they come from.
>
> Imagine a pure-Maypole httpd (in a week, you won't have to *imagine*
> one, since I actually need one) - it won't get_request because the
> Maypole request will be all there is.
>
> get_request merely merges information from the environment into the Maypole
> request object.

No. I understand all that. My point is that if $r->param('foo') or
$r->param->{foo} simply returns the internal data structure, it means I have
to write lots more supporting code:

    my $subscriber = $r->param()->{subscriber};
    if (ref $subscriber eq 'ARRAY') {
        # I'm only after a single subscriber
        $subscriber = $subscriber->[0];
    }

or conversely,
    my $subscribers = $r->param()->{subscriber};
    unless (ref $subscribers) {
        # Now I'm expecting a list
        $subscribers = [$subscribers];

    }

vs:
    my @subscribers = $r->param('subscriber');
    my $subscriber = $r->param('subscriber');

I don't *actually* care whether param() delegates to get_request(), or whether
it re-impliments the same functionality. But IMO, the param() method should
behave like CGI's and A::R's because they DWIM.

The good thing is that we don't have to agree. I can always impliment my own
param()

--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