So I've been trying to write this application that has some of the functionality provided with a JSON interface. Originally I was using a separate module to provide the JSON interface, but then realised that all I was doing was forwarding all of the requests to other modules.
I then found that I could do what I wanted by using chaining and a new view. So I created my own Catalyst::View::JSON module and used that to provide a the JSON view of the interface. I was then going to add a chain so that I could selectively choose which methods I would enable in the JSON interface. I created a method like this: sub json : Chained('/') ChainedArgs(0) { my ($self, $c) = @_; $c->stash->{view_method} = 'JSON'; } I then check in my end method if I'm supposed to show the page as JSON or my default method. At any rate I got all of that to work and then I came up to a snag. The big problem is that I want to be able to use the same code to perform the action in either the JSON view or the regular view. The issue is that I can't seem to figure out how to get a multiple rooted chain. So I want to be able to have these URLs access the same method: /json/object/ID_VALUE/action /object/ID_VALUE/action And then use the initial json chain to determine if I should show the page or show the JSON output. Is this something that is possible? Should I even be using Chaining for this? Any help would be appreciated. -- Derek Wueppelmann _______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/