[Catalyst] chained actions, knowing if current action is an endpoint or not

Renaud Drousies renaud at linuxaddicts.com
Thu Feb 1 17:30:45 GMT 2007


> Dear Catalysters,
>
> I would like to set up an action chain where the entry point to the
> chain (first action) has to do different things depending on whether
> there is another action down the chain or not.
>
> Is there a way in the API to ask Catalyst about what is pending in the
> rest of the action chain ? or a way to know if the current action is
> being used as an endpoint or not ?

If I understood your problem correctly, here's an example of what I'm
doing to handle things like /store/1234 /store/1234/comments
/store/1234/map

in e.g MyApp::Controller::Store:

# Common thing to for each "store"
sub store : Chained('') : CaptureArgs(1) : PathPart('store')

# Will handle /store/1234 -- That's the endpoint I think you are talking
about
sub index : Chained('store') : Args(0) : PathPart('')

# Will handle /store/1234/comments
sub comments : Chained('store') : Args(0) : PathPart('comments')

# Will handle /store/1234/map
sub map : Chained('store') : Args(0) : PathPart('map')

Regards
Renaud Drousies




More information about the Catalyst mailing list