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