FSA::Rules 0.26
Sponsored Links
FSA::Rules 0.26 Ranking & Summary
File size:
0.030 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
1118
Date added:
2006-10-02
Publisher:
David Wheeler and Curtis Poe
FSA::Rules 0.26 description
FSA::Rules is a Perl module to build simple rules-based state machines in Perl.
Synopsis
my $fsa = FSA::Rules->new(
ping => {
do => sub {
print "ping!n";
my $state = shift;
$state->result(pong);
$state->machine->{count}++;
},
rules => [
game_over => sub { shift->machine->{count} >= 20 },
pong => sub { shift->result eq pong },
],
},
pong => {
do => sub { print "pong!n" },
rules => [ ping => 1, ], # always goes back to ping
},
game_over => { do => sub { print "Game Overn" } }
);
$fsa->start;
$fsa->switch until $fsa->at(game_over);
This class implements a simple state machine pattern, allowing you to quickly build rules-based state machines in Perl. As a simple implementation of a powerful concept, it differs slightly from an ideal DFA model in that it does not enforce a single possible switch from one state to another. Rather, it short circuits the evaluation of the rules for such switches, so that the first rule to return a true value will trigger its switch and no other switch rules will be checked. (But see the strict attribute and parameter to new().) It differs from an NFA model in that it offers no back-tracking. But in truth, you can use it to build a state machine that adheres to either model--hence the more generic FSA moniker.
FSA::Rules uses named states so that its easy to tell what state youre in and what state you want to go to. Each state may optionally define actions that are triggered upon entering the state, after entering the state, and upon exiting the state. They may also define rules for switching to other states, and these rules may specify the execution of switch-specific actions. All actions are defined in terms of anonymous subroutines that should expect an FSA::State object itself to be passed as the sole argument.
FSA::Rules objects and the FSA::State objects that make them up are all implemented as empty hash references. This design allows the action subroutines to use the FSA::State object passed as the sole argument, as well as the FSA::Rules object available via its machine() method, to stash data for other states to access, without the possibility of interfering with the state or the state machine itself.
Synopsis
my $fsa = FSA::Rules->new(
ping => {
do => sub {
print "ping!n";
my $state = shift;
$state->result(pong);
$state->machine->{count}++;
},
rules => [
game_over => sub { shift->machine->{count} >= 20 },
pong => sub { shift->result eq pong },
],
},
pong => {
do => sub { print "pong!n" },
rules => [ ping => 1, ], # always goes back to ping
},
game_over => { do => sub { print "Game Overn" } }
);
$fsa->start;
$fsa->switch until $fsa->at(game_over);
This class implements a simple state machine pattern, allowing you to quickly build rules-based state machines in Perl. As a simple implementation of a powerful concept, it differs slightly from an ideal DFA model in that it does not enforce a single possible switch from one state to another. Rather, it short circuits the evaluation of the rules for such switches, so that the first rule to return a true value will trigger its switch and no other switch rules will be checked. (But see the strict attribute and parameter to new().) It differs from an NFA model in that it offers no back-tracking. But in truth, you can use it to build a state machine that adheres to either model--hence the more generic FSA moniker.
FSA::Rules uses named states so that its easy to tell what state youre in and what state you want to go to. Each state may optionally define actions that are triggered upon entering the state, after entering the state, and upon exiting the state. They may also define rules for switching to other states, and these rules may specify the execution of switch-specific actions. All actions are defined in terms of anonymous subroutines that should expect an FSA::State object itself to be passed as the sole argument.
FSA::Rules objects and the FSA::State objects that make them up are all implemented as empty hash references. This design allows the action subroutines to use the FSA::State object passed as the sole argument, as well as the FSA::Rules object available via its machine() method, to stash data for other states to access, without the possibility of interfering with the state or the state machine itself.
FSA::Rules 0.26 Screenshot
FSA::Rules 0.26 Keywords
FSA
Rules 0.26
Perl
to build
State machines
Perl module
state
simple
rules
build
pong
machines
FSA::Rules
FSARules
FSA::Rules 0.26
Libraries
Bookmark FSA::Rules 0.26
FSA::Rules 0.26 Copyright
WareSeeker periodically updates pricing and software information of FSA::Rules 0.26 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of FSA::Rules 0.26 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
empire state building
how to build a deck
8 simple rules
simple machines
how to build a website
how to build a dog house
state farm insurance
how to build a catapult
finite state machines
ohio state university
how to build a bar
state of the union address
state farm
state of ohio
united states postal service
algorithmic state machines
united states map
state of play
Related Software
DFA::Simple is a Perl module to implement simple Discrete Finite Automata. Free Download
PHP::Session is a Perl module to read / write PHP session files. Free Download
SpamTestBuddy is a simple, light-weight, multiple-input spam scoring tool. Free Download
Alien Perl module package contains external libraries wrapped up for your viewing pleasure! Free Download
UML::State is an object oriented module which draws simple state diagrams. Free Download
JSokoApplet is a Java applet for playing the game of Sokoban. Free Download
MyCMS perl module provides the MN::CMS Perl module used by the MyCMS. Free Download
The metric implemented in the Image::Density Perl Module estimates the density of data where there is data. Free Download
Latest Software
Popular Software
Favourite Software