[Catalyst] Mapping parameters for web services
Matt S Trout
dbix-class at trout.me.uk
Wed Oct 24 19:10:09 GMT 2007
On Wed, Oct 24, 2007 at 10:15:20AM -0700, Bill Moseley wrote:
> On Tue, Oct 23, 2007 at 09:33:13PM +0100, Matt S Trout wrote:
> >
> > I'm not sure I understand; the controller should really just be doing stuff
> > that's specific to the app UI, so surely you should be mapping both your
> > existing controllers' input params and te XMLRPC params onto calls to the
> > same model?
>
> Sorry, maybe I wasn't clear. It's not a pressing problem (I can work
> it out) but more curious about how best to do this in a catalyst way.
>
> The question was about sharing the *same* controller for different types
> of requests.
>
> The C::P::Server::XMLRPC plugin allows adding attributes to existing
> controllers, so you can do:
>
> sub user_detail : Local : XMLRPC {
> my ( $self, $c, $user_id ) = @_;
>
> # validate user_id and place user object in stash.
>
> }
Yes, and I'm saying that that's cute and all, but don't do that.
If you want to share controller code, use a common base class.
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the Catalyst
mailing list