[Catalyst] Chaining?
Alex Howarth
alex at alexph.com
Wed Nov 29 23:07:56 GMT 2006
Hi,
My code needs to create a story and then associate an image with it and then
return to a list of all stories.
The process is:
Create Story -> Search for media and relate -> display story list
I have
Controller::Story::create
Controller::Story::create_do
and
Controller::Media::search_and_relate
Controller::Media::search_and_relate_do
and
Controller::Story::list
(these take advantage of HTMLWidget
http://search.cpan.org/~jrockway/Catalyst-Manual-5.700501/lib/Catalyst/Manual/Tutorial/AdvancedCRUD.pod#HTML%3A%3AWIDGET_FORM_CREATION
hence the '_do')
I want Controller::Story::create_do to pass either the story object or id to
Controller::Media::search_and_relate (where the user can continually search by
keyword until the appropriate media is found) so that I can use this to relate
the media to.
Should I be using $c->forward('/media/search_and_relate', [ $story ]); (this is
intended to return and flow to continue?) or $c->stash->{story} = $story (if
that's only available in the template that doesn't seem appropriate) ? Or
perhaps Catalyst::DispatchType::Chained ? or maybe even stashing the story id
in the session?
I'm finding flow control quite hard to get my head around and I can't find
examples as simple as the one I require as a basis to work with.
Many Thanks,
Alex
More information about the Catalyst
mailing list