[Catalyst] How to pass args/data from one controller to another?
solar345 at gmail.com
Sat Sep 29 07:49:21 GMT 2007
On Saturday 29 Sep 2007 8:13:27 am Dustin Suchter wrote:
> So I've thought of a few different ways to pass data between Local
> methods across two different controllers, but none of them seem like
> good ideas. I still don't fully get the Catalyst framework yet, so
> I'm asking a very open question, "What are a few right ways to do
> this?" TIMTOWTDI, of course.
> Controller "Library" has a function "list_books" that, duh, displays
> a list of books in the lib. Each book is clickable creating an
> action in another function in Libarary called "read_book" that's
> only job in life as a function is to pass the $book_id over to the
> default action in the "ReadABook" controller. How do you pass the
> $book_id? Through the stash, though a path arg using 'uri_for' and a
> redirect, using forward?
You can pass the arguments as arguments to uri_for .
It appends the value at the end of the uri prefixing a /,
The passed values are available in the same way variables are passed to
functions inside the controller
Antano Solar John
More information about the Catalyst