Re: [Maypole] passing to components

From: David R. Baird (dave at riverside-cms.co.uk)
Date: Wed Sep 22 2004 - 13:40:34 BST


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.

>
>
> >>On 21 Sep 2004 at 8:29, Brian Glass wrote:
> >>
> >>
> >>
> >>>I'm using Maypole::Component (in conjunction with HTML::Mason) and
> >>>wondering if there is any way to pass a value to a component call.
> >>>Something like:
> >>>
> >>><% $request->component( "/camera/select_snapshot", current =>
> >>>"http://localhost/person/get_snapshot/1" ) %>
> >>>
> >>>Unfortunately the value passed for "current" never seems to get there.
> >>>
> >>>_______________________________________________
> >>>maypole mailing list
> >>>maypole at lists.netthink.co.uk
> >>>http://lists.netthink.co.uk/listinfo/maypole
> >>>
> >>>
> >>
> >>
> >>--
> >>Dr. David R. Baird
> >>Riverside Content Management Systems
> >>http://www.riverside-cms.co.uk
> >>
> >>_______________________________________________
> >>maypole mailing list
> >>maypole at lists.netthink.co.uk
> >>http://lists.netthink.co.uk/listinfo/maypole
> >>
> >>
> >
> >
> >
> >
> >
> >
>
>
> _______________________________________________
> maypole mailing list
> maypole at lists.netthink.co.uk
> http://lists.netthink.co.uk/listinfo/maypole

-- 
Dr. David R. Baird
Riverside Content Management Systems
http://www.riverside-cms.co.uk

_______________________________________________ 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