On Wed, Oct 24, 2007 at 07:10:09PM +0100, Matt S Trout wrote: > > 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.
Why don't you like that? > If you want to share controller code, use a common base class. Ok, but In which way? So, there's a bunch of existing actions spread around a handful of controllers. Now you want to add in XMLRCP where each request must alter in the input parameters to use the existing controller code. Do you create new controller classes just for the XMLRPC requests where they rearrange the parameters and then call the web controller action? Or do you factor out the common code into a base class for each controller and then have web and XMLRPC (and what ever else comes along) to handle those requests? package App::Controller::User; use Base 'App::Contoller::User::Base'; sub user_detail : Local { my ( $self, $c, $user_id ) = @_; return $self->fetch_user_detail( $c, $user_id ); } package App::Controller::XMLRPC::User; use Base 'App::Contoller::User::Base'; sub user_detail : XMLRPC { my ( $self, $c ) = @_; my $user_id = $c->req->params->{user_id}; return $self->fetch_user_detail( $c, $user_id ); } Or are you thinking of something else? -- Bill Moseley [EMAIL PROTECTED] _______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/