Andreas 'ac0v' Specht > Hyper > Hyper::Control::Flow

Download:
Hyper-v0.05.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  1
View/Report Bugs
Module Version: v1.1   Source  

NAME ^

Hyper::Control::Flow - base class for all flow and container controls

VERSION ^

This document describes Hyper::Control::Flow 1.1

SYNOPSIS ^

    package Hyper::Control::Flow::FSampleControl;

    use Class::Std::Storable;
    use base qw(Hyper::Control::Flow);

    1;

DESCRIPTION ^

This class allows you to create flow controls which are defined in your configuration. It checks conditions to walk different transitions and calls generated functions and functions which where implemented in the code you've written. There are also methods to get the current state recursivelay (including all embedded controls) and another method to restore an old state (this is needed for browser back and forward button).

ATTRIBUTES ^

identifier
state
config

SUBROUTINES/METHODS ^

START

    my $object = Hyper::Control::Flow::FSampleControl->new();

Initialize Hyper::Identifier for persistance of ids. Calls _get_config and stores the config into the config attribute. If we have no state we set current state to START.

_get_config :RESTRICTED

Get config for instance of this control.

get_object

    my $embedded_control = $self->get_object('cSelectPerson');

Get an embedded control. Control Object is created if it wasn't existant since yet. Control class is read from config object. This method will also initialize and append validators which are configured for a control.

work

    $object->work();

Start workflow of flow control.

Generated Code comes from your step config. Call generated actions, call your action methods if it they where implemented and check for transitions. If the condition of a transition is true the internal state of Hyper::Control::Flow is updated the state is updated and method work is called again.

Workflow description of the work method:

$self->_action_of_step()
$self->ACTION_of_step()
$embedded_control->work()
check transitions
if current transition condition is valid

update internal state and call work again

if no transitions left

return

get_state

    my $state = $object->get_state();

Get the current state of an object.

set_state

    $object->set_state('step name');

Set state of the control. Valid states are the names of your steps defined in your config.

get_state_recursive

    my $viewstate = $object->get_state_recursive();

Get the state of this and all embedded controls.

Return structure: [ 'state_of_this_control', { name_of_embedded_1 => [...] }, { name_of_embedded_2 => [...] }, ]

restore_state_recursive

    $object->restore_state_recursive($viewstate);

Restore state of this and all embedded controls eg. after GET or POST. Use the return value from get_state_recursive to restore a state.

_check_transitions :PROTECTED

    my $destination_state = $self->_check_transitions();

This method is used to check if a valid transition can be found.

is_valid

    my $all_embedded_controls_are_valid = $object->is_valid();

Check if all embedded controls are valid and return a boolean value. This method performs the group validation only if all single validators are valid.

STORABLE_thaw_post :CUMULATIVE

This method is called automatically. It deletes the state object attribute.

DIAGNOSTICS ^

CONFIGURATION AND ENVIRONMENT ^

DEPENDENCIES ^

INCOMPATIBILITIES ^

BUGS AND LIMITATIONS ^

RCS INFORMATIONS ^

Last changed by

$Author: ac0v $

Id

$Id: Flow.pm 318 2008-02-16 01:57:57Z ac0v $

Revision

$Revision: 318 $

Date

$Date: 2008-02-16 02:57:57 +0100 (Sa, 16 Feb 2008) $

HeadURL

$HeadURL: http://svn.hyper-framework.org/Hyper/Hyper/tags/0.05/lib/Hyper/Control/Flow.pm $

AUTHOR ^

Andreas Specht <ACID@cpan.org>

LICENSE AND COPYRIGHT ^

Copyright (c) 2007, Andreas Specht <ACID@cpan.org>. All rights reserved.

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

syntax highlighting: