Peter Flanigan > CatalystX-Usul-0.17.1 > CatalystX::Usul::Action

Download:
catalystx-usul/CatalystX-Usul-0.17.1.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: v0.17.1   Source  

Name ^

CatalystX::Usul::Action - A generic action class

Version ^

Describes v0.17.$Rev: 1 $

Synopsis ^

   package YourApp::Controller::YourController;

   BEGIN { extends q(CatalystX::Usul::Controller) }

   sub some_method : Chained('/') PathPart('') Args(0) HasActions {
      my ($self, $c) = @_;

      $c->model( q(some_model) )->add_buttons( $c, qw(Save Delete) );

      return;
   }

   sub delete_action : ActionFor('some_method.delete') {
   }

   sub save_action : ActionFor('some_method.save') {
   }

Description ^

The _parse_HasActions_attr method in the base controller class causes Catalyst to chain this execute method when a form is posted to an end point the sets the HasActions attribute

Actions should define one or more ActionFor attributes whose argument takes the form; method name dot lower case button name, where the button name was also passed to add_buttons

Subroutines/Methods ^

execute

The verb is obtained from the request object via the stash. Verbs can be set the _method parameter which is removed to prevent this from executing more than once. If we're using it, check to see if the form token is valid and remove it from the form. Recover the button to subroutine map for this action by introspection and forward to that method. Log an error if one occurred and add it's text to the result block. In the event that an error occurred, set the override attribute in the stash which causes the HTML view to call HTML::FillInForm to preserve the form's state

Configuration and Environment ^

None

Diagnostics ^

Errors are logged to $controller->log->error

Dependencies ^

Catalyst::Action

Incompatibilities ^

There are no known incompatibilities in this module

Bugs and Limitations ^

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Author ^

Peter Flanigan, <Support at RoxSoft.co.uk>

License and Copyright ^

Copyright (c) 2014 Peter Flanigan. All rights reserved

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

syntax highlighting: