Re: [Maypole] passing to components

From: Brian Glass (brian at glassbrian.com)
Date: Wed Sep 22 2004 - 16:25:03 BST


David R. Baird wrote:

>On 22 Sep 2004 at 8:13, Brian Glass wrote:
>
>
>
>>David R. Baird wrote:
>>
>>
>>
>>>On 21 Sep 2004 at 14:21, David R. Baird wrote:
>>>
>>>
>>>
>>>
>>>
>>>>You'll need to encode your arguments as a url query string and append
>>>>them to the path. But if 'current' is the current request, you can
>>>>get a whole Maypole request object for it inside
>>>>/camera/select_snapshot from $ARGS{request}->{parent}
>>>>
>>>>
>>>>
>>>>
>>>Or you could use a Mason subrequest instead of a Maypole subrequest:
>>>
>>><% $m->subexec( comp => "/camera/select_snapshot", args => [ current
>>>=> "http://localhost/person/get_snapshot/1" ] ) %>
>>>
>>>Inside the subrequest you can get the original Mason request from
>>>$m->parent_request, from which you can probably extract the
>>>information you want to pass in the 'current' argument.
>>>
>>>d.
>>>
>>>
>>>
>>>
>>I thought about that, but I realized what I really wanted was a Maypole
>>request. I want a Maypole Model Class method to be called. Is there a
>>way to make that happen using a Mason request?
>>
>>
>
>
>I would expect the Mason subrequest to trigger the Maypole model
>method to be called, but that might depend on whether you're using
>Mason as a view (Maypole::View::Mason) or as a front-end
>(MasonX::Maypole). If you're using the latter, let me know if it
>works or not, and if it doesn't I'll see if I can figure out how to
>make it work.
>
>By the way, Maypole::Component won't work with MasonX::Maypole,
>because it calls handler_guts which doesn't exist in MasonX::Maypole.
>I think there's a bit of refactoring needing done in Maypole.pm to
>separate the model, view and controller a bit more.
>
>Maybe it would be worth patching Maypole::Component to accept
>arguments?
>
>d.
>

What would be nice would be to use the standard Mason syntax like:

<& /camera/select_snapshot, arg1 => "foo", arg2 => "foo2", ... &>

I'm guessing that's not possible.

At this point I'm using Mason as view class. What does MasonX::Maypole
buy me and should I switch to that?

_______________________________________________
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