Zing::Channel - Shared Communication
Multi-process Communication Mechanism
use Zing::Channel; my $chan = Zing::Channel->new(name => 'share'); # $chan->recv;
This package represents a mechanism of interprocess communication and synchronization via message passing.
This package inherits behaviors from:
Zing::PubSub
This package uses type constraints from:
Zing::Types
This package has the following attributes:
name(Str)
This attribute is read-only, accepts (Str) values, and is optional.
(Str)
This package implements the following methods:
recv() : Maybe[HashRef]
The recv method receives a single new message from the channel.
my $chan = Zing::Channel->new(name => 'recv-01'); $chan->recv;
my $chan = Zing::Channel->new(name => 'recv-02'); $chan->send({ status => 'works' }); $chan->recv;
renew() : Int
The renew method returns truthy if it resets the internal cursor, otherwise falsy.
my $chan = Zing::Channel->new(name => 'renew-01'); $chan->send({ status => 'works' }) for 1..5; $chan->renew;
my $chan = Zing::Channel->new(name => 'renew-02'); $chan->send({ status => 'works' }) for 1..5; $chan->recv; $chan->drop; $chan->renew;
reset() : Int
The reset method always reset the internal cursor and return truthy.
my $chan = Zing::Channel->new(name => 'reset-01'); $chan->send({ status => 'works' }) for 1..5; $chan->recv; $chan->recv; $chan->reset;
send(HashRef $value) : Int
The send method sends a new message to the channel and return the message count.
my $chan = Zing::Channel->new(name => 'send-01'); $chan->send({ status => 'works' });
size() : Int
The size method returns the message count of the channel.
my $chan = Zing::Channel->new(name => 'size-01'); $chan->send({ status => 'works' }) for 1..5; $chan->size;
term() : Str
The term method returns the name of the channel.
my $chan = Zing::Channel->new(name => 'term-01'); $chan->term;
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.