Class::Prevayler - Prevayler implementation - www.prevayler.org
use Class::Prevayler; my $prevayler = Class::Prevayler->new( system => new Your::System, directory => 'prevayler/demo/' ); $prevayler->start(); my $cmd_obj = Your::Command::Object->new(); $prevayler->execute( $cmd_obj ); $prevayler->take_snapshot();
THIS IS BETA-SOFTWARE!!
Class::Prevayler - aka 'Perlvayler' - is a Perl implementation of the prevayler concept.
You can find an introduction to this concept on www.prevayler.org.
This module overloads the 'time', 'localtime' and 'gmtime' functions to make the system deterministic.
Usage : $prevayler->new() Purpose : creates a new object Returns : the new prevayler-object Argument : you can use key-value pairs to initialize the attributes
Usage : $prevayler->start() Purpose : recovers the old system state Returns : nothing Argument : none Comments : You have to call it before you can use execute(), even if there is no old serialized state
Usage : $prevayler->execute() Purpose : execute one command object on the system, and log it Returns : nothing Argument : command object Comments : all command objects must implement a 'execute()' method
Usage : $prevayler->take_snapshot() Purpose : produce a serialized image of the system Returns : nothing Argument : command object Comments : all command objects must implement a 'execute()' method
Usage : $prevayler->system( new My::System ) my $system = $prevayler->system(); Purpose : access to the prevalent system Returns : returns the actual system if called without argument Argument : new prevalent system
Usage : $prevayler->directory( './prevayler/' ) my $directory = $prevayler->directory(); Purpose : sets the directory where all serialized objects are stored Returns : returns the actual directory if called without argument Argument : new directory
Usage : $prevayler->serializer( \&mySerializer ) my $serializer = $prevayler->serializer(); Purpose : define the serializer. The serializer is called with a structure (an object) and returns a string representation of this structure. The default serializer is implemented with Data::Dumper. Returns : returns the actual serializer if called without argument Argument : reference to a subroutine
Usage : $prevayler->deserializer( \&myDeSerializer ) my $deserializer = $prevayler->deserializer(); Purpose : define the deserializer. The deserializer is called with a serialized structure and returns this structure. The default deserializer is implemented with eval. Returns : returns the actual deserializer if called without argument Argument : reference to a subroutine
- none known, but: this is beta-software, there will be API and fileformat changes.
Nathanael Obermayer CPAN ID: nathanael natom-pause@smi2le.net
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
perl(1).
http://www.prevayler.org
To install Class::Prevayler, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::Prevayler
CPAN shell
perl -MCPAN -e shell install Class::Prevayler
For more information on module installation, please visit the detailed CPAN module installation guide.