Salvation::System - Base class for a system
package YourSystem; use Moose; extends 'Salvation::System'; no Moose;
Carp
Moose
Salvation::Roles::SharedStorage
Salvation::Roles::AppArgs
$system_instance -> start();
A method which really starts the system and returns the output of the whole process.
$self -> stop();
A method which interrupts the system immediately.
$self -> run_service( $absolute_package_name ); $self -> run_service( $absolute_package_name, @service_constructor_args );
A method which runs the full cycle of the given service and returns appropriate Salvation::Service::State if run was successfull.
$self -> Service( $relative_package_name ); $self -> Service( $relative_package_name, \%flags );
Add a service with $name to the list of system's services.
$name
You can use \%flags to do some tweaking providing following keys:
\%flags
A CodeRef which will be called in order to change service's name.
transform_name => sub { my ( $system_instance, $service_name ) = @_; $service_name =~ s/MattSmith/DavidTennant/g; return $service_name; }
Useful when you feel especially crutchy.
A CodeRef which will be called in order to check whether the service needs to be run, or not. Should return boolean value.
constraint => sub { my ( $system_instance, $service_name ) = @_; return ( int( rand( 2 ) ) == 1 ); }
$self -> Fatal( @anything );
Add @anything to the list of fatal errors. The thing will die with this list in the end.
@anything
die
You can redefine following methods to achieve your own goals.
Very first method to be executed in the execution flow. The only argument is $self which is current system's instance.
$self
A method which is responsible for generating final system's output. Its return value is the return value of Salvation::System::start.
Salvation::System::start
Arguments
Current system's instance.
$states
An ArrayRef of HashRefs. Each HashRef has following keys:
Service's package name.
Salvation::Service::State object instance.
Salvation::Service::OutputProcessor object instance. It is not present if the service hasn't defined an output processor.
Triggerred by Salvation::Service when it fails to load hook.
$data
A HashRef with error data. The keys are:
$@
Containts an error as it has been passed to die.
Hook's package name.
Service's instance.
Triggerred by Salvation::Service::View when it fails to execute any model's method during process_node.
process_node
A HashRef telling how and which method has been called.
The keys are:
Method name.
An ArrayRef with method's arguments.
View's package name.
View's instance.
Triggerred by Salvation::Service when it fails to run scheduled controller method.
Triggerred by Salvation::System when it fails to run the service.
Triggerred by Salvation::System when it is about to rerun the service without hooks.
Triggerred by Salvation::SharedStorage when it is about to call its get and the owner of storage is Salvation::Service.
get
Storage key name.
Triggerred by Salvation::SharedStorage when it is about to call its put and the owner of storage is Salvation::Service.
put
A value which is about to be stored.
Triggerred by Salvation::SharedStorage when it is about to call its put with the key equal to '$@' and the owner of storage is Salvation::Service.
Triggerred by Salvation::System when the service has been interrupted and service's storage has a key named '$@'.
Containts an error as it has been passed to Salvation::SharedStorage::put.
Salvation::SharedStorage::put
Triggerred by Salvation::SharedStorage when it is about to call its get and the owner of storage is Salvation::System.
Triggerred by Salvation::SharedStorage when it is about to call its put and the owner of storage is Salvation::System.
Triggerred by Salvation::SharedStorage when it is about to call its put with the key equal to '$@' and the owner of storage is Salvation::System.
To install Salvation, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Salvation
CPAN shell
perl -MCPAN -e shell install Salvation
For more information on module installation, please visit the detailed CPAN module installation guide.