GX::Action

Module Version: 0.2000_01

NAME

GX::Action - Action class

SYNOPSIS

# Load the class
use GX::Action;

# Create a new action object
$action = GX::Action->new(
controller => 'MyApp::Controller::Blog',
method => 'show_post'
);

# Call the action method
$action->call( $context );

# Dispatch the action
$action->dispatch( $context );

DESCRIPTION

This module provides the GX::Action class which extends the GX::Callback class.

METHODS

Constructor

new

Returns a new GX::Action object.

$action = GX::Action->new( %attributes );
Attributes:
  • controller ( GX::Controller object | string ) [ required ]

    The class name or instance of the controller component to which the action belongs.

  • method ( string ) [ required ]

    The name of the action method.

Returns:
Exceptions:

Public Methods

call

Calls the action method.

$action->call( $context );
Arguments:

code

Returns a reference to the action method.

$code = $action->code;
Returns:
  • $code ( CODE reference )

controller

Returns the controller component instance to which the action belongs.

$controller = $action->controller;
Returns:

dispatch

Dispatches the action using the controller's dispatch mechanism.

$action->dispatch( $context );
Arguments:

id

Returns a string identifying the action (not the action object).

$id = $action->id;
Returns:
  • $id ( string )

method

Returns the name of the action.

$method = $action->method;
Returns:
  • $method ( string )

name

An alias for method().

$name = $action->name;
Returns:
  • $name ( string )

AUTHOR

Jörg A. Uzarek <uzarek@runlevelnull.de>

COPYRIGHT AND LICENSE

Copyright © 2009-2011 Jörg A. Uzarek.

This module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation.