Reaction::UI::Controller::Role::Action::Object
Provides an object action, which attempts to find an item in a collection and store it in the stash.
object
package MyApp::Controller::Foo; use base 'Reaction::Controller'; use Reaction::Class; with( 'Reaction::UI::Controller::Role::GetCollection', 'Reaction::UI::Controller::Role::Action::Simple', 'Reaction::UI::Controller::Role::Action::Object', ); __PACKAGE__->config( action => { object => { Chained => 'base', PathPart => 'id' }, foo_action => { Chained => 'object' }, } ); sub base :Chained('/base') :CaptureArgs(0) { ... } sub foo_action :Args(0){ my($self, $c) = @_; $c->stash->{object}; #object is here.... }
The following methods must be provided by the consuming class:
get_collection
Chain link, captures one argument. Attempts to find a single object by passing the captured argument to the find method of the collection returned by get_collection. If the object is found it is stored in the stash under the object key.
find
See Reaction::Class for authors.
See Reaction::Class for the license.
4 POD Errors
The following errors were encountered while parsing the POD:
Unknown directive: =over4
'=item' outside of any '=over'
To install Reaction, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Reaction
CPAN shell
perl -MCPAN -e shell install Reaction
For more information on module installation, please visit the detailed CPAN module installation guide.