Zing::Watcher - Watcher Process
Watcher Process
package MyApp; use parent 'Zing::Watcher'; sub perform { time; } sub receive { my ($self, $from, $data) = @_; [$from, $data]; } sub scheme { ['MyApp::Handler', [], 1]; } package main; my $myapp = MyApp->new; # $myapp->execute;
This package provides a Zing::Process which forks a scheme using Zong::Fork and maintains the desired active processes. The standard process perform and receive methods operate as expected.
scheme
perform
receive
This package inherits behaviors from:
Zing::Process
This package uses type constraints from:
Zing::Types
This package supports the following scenarios:
# given: synopsis $myapp->perform;
The perform method is meant to be implemented by a subclass and is automatically invoked iteratively by the event-loop.
# given: synopsis $myapp->receive($myapp->name, { status => 'ok' });
The receive method is meant to be implemented by a subclass and is automatically invoked iteratively by the event-loop.
# given: synopsis $myapp->scheme;
The scheme method is meant to be implemented by a subclass and is automatically invoked when the process is executed.
This package has the following attributes:
on_scheme(Maybe[CodeRef])
This attribute is read-only, accepts (Maybe[CodeRef]) values, and is optional.
(Maybe[CodeRef])
This package implements the following methods:
scheme(Any @args) : Scheme
The scheme method, when not overloaded, executes the callback in the "on_scheme" attribute and expects a process scheme to be processed.
my $watcher = Zing::Watcher->new( on_scheme => sub { ['MyApp::Handler', [], 1] }, ); $watcher->scheme;
Al Newkirk, awncorp@cpan.org
awncorp@cpan.org
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".
Wiki
Project
Initiatives
Milestones
Contributing
Issues
To install Zing, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zing
CPAN shell
perl -MCPAN -e shell install Zing
For more information on module installation, please visit the detailed CPAN module installation guide.