ManaTools::Shared::ActionsRole

Section: User Contributed Perl Documentation (3)
Updated: 2017-07-06
Page Index
 

NAME

    ManaTools::Shared::ActionsRole - a Actions Moose::Role

 

SYNOPSIS package Foo;

    with 'ManaTools::Shared::ActionsRole';

    1;

    ...

    my $f = Foo->new();
    my @actionnames = $f->get_actions();
    $f->add_action('aname', 'a label', $item, sub { my $self = shift; my @params = @_; ... ; return 'foo'; }, sub { return 1; });
    my $res = $f->act('aname', 'param1', 'param2', @params);
    $f->remove_action('aname');

 

DESCRIPTION

    This Role is a collection of Actions

 

SUPPORT

    You can find documentation for this Role with the perldoc command:

    perldoc ManaTools::Shared::ActionsRole

 

AUTHOR

    Maarten Vanraes <alien@rmail.be>

 

COPYRIGHT and LICENSE

Copyright (c) 2015 Maarten Vanraes <alien@rmail.be>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2, as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  

METHODS

 

get_actions

OUTPUT

    array of string

DESCRIPTION

    this method returns a list of action names

 

act

INPUT

    $key: string
    optional action parameters

OUTPUT

    return value of the action

DESCRIPTION

    this method calls an action

 

add_action

INPUT

    $name: Str
    $label: Str
    $action: CodeRef
    $valid: CodeRef

DESCRIPTION

    this method adds an action

 

remove_action

INPUT

    $key: string

DESCRIPTION

    this method removes an action


 

Index

NAME
SYNOPSIS package Foo;
DESCRIPTION
SUPPORT
AUTHOR
COPYRIGHT and LICENSE
METHODS
get_actions
act
add_action
remove_action