Linux SoftwareProgrammingLibrariesFSA::Rules 0.26

FSA::Rules 0.26


FSA::Rules is a Perl module to build simple rules-based state machines in Perl. Synopsis my $fsa = FSA::Rules->new( pin
Developer:   David Wheeler and Curtis Poe
      more software by author →
Price:  0.00
License:   Perl Artistic License
File size:   30K
Language:   
OS:   
Rating:   0 /5 (0 votes)
Your vote:  
enlarge screenshot


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 it's easy to tell what state you're 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.

Requirements:
  • Perl
    tags fsa rules  the state  state machine  the fsa  fsa state  game over  other states  sole argument  state object  the sole  what state  based state  rules based  

    Download FSA::Rules 0.26


     http://ftp.hostingromania.ro/Linux/mirrors/ftp.cpan.org/authors/id/D/DW/DWHEELER/FSA-Rules-0.26.tar.gz


    Authors software

    FSA::Rules 0.26 (by David Wheeler and Curtis Poe)
    FSA::Rules is a Perl module to build simple rules-based state machines in Perl.

    Synopsis

    my $fsa = FSA::Rules->new(
    pin


    Similar software

    FSA::Rules 0.26 (by David Wheeler and Curtis Poe)
    FSA::Rules is a Perl module to build simple rules-based state machines in Perl.

    Synopsis

    my $fsa = FSA::Rules->new(
    pin

    State Machine Compiler 4.3.3 (by Charles Rapp)
    State Machine Compiler takes a state machine stored in an .sm file and generates the state pattern classes in nine programming langua

    C++ Machine Objects 0.9.4 (by Eduard Hiti)
    C++ Machine Objects class library supports a subset of the UML statechart notation for implementing hierarchical state machines in st

    POE::Component::Basement 0.01 (by Robert Sedlacek)
    POE::Component::Basement provides Class::Std and base POE component functionality.

    SYNOPSIS

    package POE::MyComponent;

    #

    Concurrent Hierarchical State Machine 4.2 (by Paul J. Lucas and Fabio Riccardi)
    Concurrent Hierarchical State Machine (CHSM) is a language system for specifying concurrent, hierarchical, finite state machines (an

    Ragel State Machine Compiler 5.16 (by Adrian Thurston)
    Ragel State Machine Compiler compiles finite state machines from regular languages into executable C/C++/Objective-C code

    Object::Relation::Meta::Type 0.1.0 (by Kineticode, Inc.)
    Object::Relation::Meta::Type is an Object::Relation Data type validation and accessor building.

    Synopsis

    Object::Relation::Me

    PyCAGE 1.1.4 (by Erik Max Francis)
    PyCAGE fairly generic and complete cellular automata simulation engine.

    It's written in Python and it supports both 1D and 2D auto

    nfcount 0.4 (by Serg Repalov)
    nfcount is tool for count network traffic by using rules

    IP Tables State 2.1 (by Phil Dibowitz)
    Having worked with IP Filter on Solaris for a few years now, when I work on IP Tables in Linux I come to miss State Top


    Other software in this category

    zlib 1.2.3 (by Jean-loup Gailly)
    zlib is designed to be a free, general-purpose, legally unencumbered, lossless data-compression library for use on virtually any comp

    libjpeg v6b (by Independent JPEG Group)
    libjpeg is a library for handling the JPEG (JFIF) image format

    OpenSSL 0.9.7c (by The OpenSSL Project Team)
    The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implement

    libxml2 2.6.27 (by DV)
    Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform), libxml2 library i

    GNU C library 2.4 (by Andreas Jaeger)
    GNU C library (glibc) is one of the most important components of GNU Hurd and most modern Linux distributions.

    GNU C library is us

  •     search


    Featured Software

    jEdit 4.3 pre8
    jEdit is an Open Source text editor written in Java

    Opera 9.02
    Surf the Internet in a safer, faster, and easier way with Opera browser

    GNU Aspell 0.60.4
    GNU Aspell is a Free and Open Source spell checker designed to eventually replace Ispell


    Subscribe in Rojo
    Google Reader
    Add to My Yahoo!

    Add to My AOL
    Subscribe with Bloglines
    Subscribe in NewsGator Online
    Add 'nixbit linux software' to Newsburst from CNET News.com
    del.icio.us nixbit linux software


    Top tags