NAME

Zing::Mailbox - Process Mailbox

ABSTRACT

Interprocess Communication Mechanism

SYNOPSIS

use Zing::Mailbox;

my $mailbox = Zing::Mailbox->new(name => rand);

# $mailbox->recv;

DESCRIPTION

This package provides represents a process mailbox, the default mechanism of interprocess communication.

INHERITS

This package inherits behaviors from:

Zing::PubSub

LIBRARIES

This package uses type constraints from:

Zing::Types

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 mailbox.

recv example #1
# given: synopsis

$mailbox->recv;
recv example #2
# given: synopsis

$mailbox->send($mailbox->term, { status => 'hello' });

$mailbox->recv;

reply

reply(HashRef $message, HashRef $value) : Int

The reply method sends a message to the mailbox represented by the $bag received and returns the size of the recipient mailbox.

reply example #1
# given: synopsis

$mailbox->send($mailbox->term, { status => 'hello' });

my $message = $mailbox->recv;

$mailbox->reply($message, { status => 'thank you' });

send

send(Str $key, HashRef $value) : Int

The send method sends a new message to the mailbox specified and returns the size of the recipient mailbox.

send example #1
# given: synopsis

$mailbox->send($mailbox->term, { status => 'hello' });

size

size() : Int

The size method returns the message count of the mailbox.

size example #1
# given: synopsis

my $size = $mailbox->size;

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".

PROJECT

Wiki

Project

Initiatives

Milestones

Contributing

Issues