That's what I was trying before, but check this out: # CODE 1 #in MyApp::Controller::Libaray sub read_book : Local { my ($self, $c) = @_; $c->response->redirect($c->uri_for('/readabook/read_book' )); }
# CODE 2 #in MyApp::Controller::Libaray sub read_book : Local { my ($self, $c) = @_; my ($bid, $pid) = ("2","345"); $c->response->redirect($c->uri_for("/readabook/read_book/$bid/$pid")); } # CODE 3 #in MyApp::Controller::ReadABook sub read_book : Local { my ($self, $c, $book_id, $page_id) = @_; #do stuff... } When I use CODE 1 the app correctly executes CODE 3, but of course there are no args passed along, so $book_id and $page_id are uninitalized. When I use CODE 2, Catalyst executes my default action (home) - my guess it it does this because it can't find a specific "/readabook/read_book/2/345". For the record I also tried using CODE 1 and stuffing the values I needed into the stash, but that didn't work either. So how do you pass args with uri_for? I was hoping to RTFM, but I couldn't find the FM for "uri_for", and I decided to consult the Oracle (this mailing list) before trouncing through Catalyst sourcecode. -d Antano Solar wrote: > 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. >> >> i.e. >> >> 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? >> >> thanks, >> -d > > 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 > > > > > _______________________________________________ > List: Catalyst@lists.rawmode.org > Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst > Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ > Dev site: http://dev.catalyst.perl.org/ > _______________________________________________ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/