[Catalyst] Chained('.') counter-intuitive?

Pedro Melo melo at simplicidade.org
Fri Nov 10 12:42:03 GMT 2006


Hi,

I've been learning to use chained actions in the past few hours, and  
I must say I admire the though that went into them and the default  
values for each attribute, they are extremely elegant.

The only issue I have is with Chained('.').

I prefer to keep the actions related to the same concept in the same  
controller. For example, if I have a Film controller, I expect to  
find there the view and delete actions, for example.

With chained actions, I also expect to see this type of urls:

/films/1/view
/films/2/delete

Right now I have to write this:

package cad::Controller::Films;

use strict;
use warnings;
use base 'Catalyst::Controller';

sub films  : Chained          CaptureArgs(1) {}
sub view   : Chained('films') Args(0)        {}
sub delete : Chained('films') Args(0)        {}

I was expecting to write Chained('.') in sub view and sub delete, but  
to do that I would have to move them to a different controller,  
cad::Controller::Films::View and C::Films::Delete.

My reasoning is that '.' is the current controller, not the parent  
controller. I would use '..' for that one...

Any thoughs?

best regards,
--
Pedro Melo
JID: xmpp:melo at simplicidade.org





More information about the Catalyst mailing list