NAME
Zing::Single - Single Process
ABSTRACT
Single Process
SYNOPSIS
package MyApp;
use parent 'Zing::Single';
sub perform {
my ($self) = @_;
time;
}
sub receive {
my ($self, $from, $data) = @_;
[$from, $data];
}
package main;
my $myapp = MyApp->new;
# $myapp->execute;
DESCRIPTION
This package provides a Zing::Process which runs once and shuts-down, but otherwise operates as a typical process and invokes its receive
and perform
methods.
INHERITS
This package inherits behaviors from:
LIBRARIES
This package uses type constraints from:
SCENARIOS
This package supports the following scenarios:
perform
# given: synopsis
$myapp->perform;
The perform method is meant to be implemented by a subclass and is automatically invoked iteratively by the event-loop.
receive
# given: synopsis
$myapp->receive($myapp->name, { task => 'fuzzy_logic' });
The receive method is meant to be implemented by a subclass and is automatically invoked iteratively by the event-loop whenever a process receives a message in its mailbox.
AUTHOR
Al Newkirk, awncorp@cpan.org
LICENSE
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".