Hyper::Control::Flow - base class for all flow and container controls
This document describes Hyper::Control::Flow 1.1
package Hyper::Control::Flow::FSampleControl; use Class::Std::Storable; use base qw(Hyper::Control::Flow); 1;
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).
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 for instance of this control.
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.
$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:
update internal state and call work again
return
my $state = $object->get_state();
Get the current state of an object.
$object->set_state('step name');
Set state of the control. Valid states are the names of your steps defined in your config.
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 => [...] }, ]
$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.
my $destination_state = $self->_check_transitions();
This method is used to check if a valid transition can be found.
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.
This method is called automatically. It deletes the state object attribute.
version
Hyper::Control
Class::Std::Storable
Hyper::Error
Hyper::Config::Reader::Flow
Hyper::Identifier
Hyper::Functions
Hyper::Singleton::Debug
Hyper::Singleton::Context
List::MoreUtils
$Author: ac0v $
$Id: Flow.pm 318 2008-02-16 01:57:57Z ac0v $
$Revision: 318 $
$Date: 2008-02-16 02:57:57 +0100 (Sa, 16 Feb 2008) $
$HeadURL: http://svn.hyper-framework.org/Hyper/Hyper/tags/0.05/lib/Hyper/Control/Flow.pm $
Andreas Specht <ACID@cpan.org>
<ACID@cpan.org>
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.
To install Hyper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Hyper
CPAN shell
perl -MCPAN -e shell install Hyper
For more information on module installation, please visit the detailed CPAN module installation guide.