NAME

App::Manoc::ControllerRole::Object - Role for controllers accessing a result row

VERSION

version 2.99.2

DESCRIPTION

This is a base role for all Manoc controllers which manage a row from a resultset.

ACTIONS

object

This action is the chain root for all the actions which operate on a single identifer, e.g. view, edit, delete.

METHODS

get_object

Search the object in stash->{resultset} using given the pk.

SYNPOSYS

package App::Manoc::Controller::Artist;

use Moose;
extends "Catalyst::Controller";
with "App::Manoc::ControllerRole::Object";

__PACKAGE__->config(
    # define PathPart
    action => {
        setup => {
            PathPart => 'artist',
        }
    },
    class      => 'ManocDB::Artist',
    );

# manages /artist/<id>
sub view : Chained('object') : PathPart('') : Args(0) {
   my ( $self, $c ) = @_;

   # render with default template
   # object will be accessible in $c->{object}
   # object id in object_pk
}

AUTHORS

  • Gabriele Mambrini <gmambro@cpan.org>

  • Enrico Liguori

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Gabriele Mambrini.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.