Anton Berezin > IPC-Message-Minivan-0.01_08 > IPC::Message::Minivan

Download:
IPC-Message-Minivan-0.01_08.tar.gz

Dependencies

Annotate this POD

Module Version: 0.01_08   Source  

NAME ^

IPC::Message::Minivan - a minimalistic message bus

VERSION ^

This document describes IPC::Message::Minivan version 0.01_08

SYNOPSIS ^

        my $van = IPC::Message::Minivan->new(host => 'localhost');
        # host is mandatory
        # port can be specified; 6826 is the default

        # Send a message to a channel "chan1".  The message
        # can be an arbitrary Perl data structure,
        # which should not be too big.
        $van->msg("chan1", $msg);

        # Subscribe to a channel "chan1".
        $van->subscribe("chan1");

        # Subscribe to two channels, "chan2" and "chan3"
        $van->subscribe("chan2", "chan3");

        # Get all pending messages from all subscribed channels,
        # no way to find out what the channel was for an
        # individual message, no waiting.
        my @m = $van->get;

        # Get all pending messages from all subscribed channels,
        # no way to find out what the channel was for an
        # individual message, wait up to 5 seconds for messages
        # to arrive.
        my @m = $van->get(5);

        # Get all pending messages from specified channels,
        # no way to find out what the channel was for an
        # individual message, no waiting.
        my @m = $van->get("chan1", "chan2");

        # Get all pending messages from specified channels,
        # no way to find out what the channel was for an
        # individual message, wait up to 5 seconds for messages
        # to arrive.
        my @m = $van->get(5, "chan1", "chan2");

        # Get all pending messages from all subscribed channels.
        # Returns a list of arrayrefs, first element in each is the
        # channel name, second is the message.  No waiting.
        my @m = $van->get([]);

        # Get all pending messages from all subscribed channels.
        # Returns a list of arrayrefs, first element in each is the
        # channel name, second is the message.  Wait up to 5
        # seconds for messages to arrive.
        my @m = $van->get(5, []);

        # Get all pending messages from all subscribed channels.
        # Returns a list of arrayrefs, first element in each is the
        # channel name, second is the message.  No waiting.
        my @m = $van->get(["chan1", "chan2"]);

        # Get all pending messages from all subscribed channels.
        # Returns a list of arrayrefs, first element in each is the
        # channel name, second is the message.  Wait up to 5
        # seconds for messages to arrive.
        my @m = $van->get(5, ["chan1", "chan2"]);

        # Get only the first pending message.  The variations above
        # apply, so:
        my $m = $van->get;
        my $m = $van->get(5);
        my $m = $van->get("chan1", "chan2");
        my $m = $van->get(5, "chan1", "chan2");
        my $m = $van->get([]);
        my $m = $van->get(5, []);
        my $m = $van->get(["chan1", "chan2"]);
        my $m = $van->get(5, ["chan1", "chan2"]);

DESCRIPTION ^

IPC::Message::Minivan provides a minimalistic interface to a minimalistic message bus.

There is no store-and-forward, there is no authentication, there are no guarantees about delivery. You've been warned.

The synopsis section above more or less covers it all.

DEPENDENCIES ^

Perl 5.8.4 or above, IPC::Messaging, JSON::XS.

INCOMPATIBILITIES ^

This module, in all likelihood, will only work on Unix-like operating systems.

BUGS AND LIMITATIONS ^

Due to the current state of the IPC::Messaging module, if a particular subscriber never calls get() and never exits, the minivan daemon will eventually become clogged and will stop delivering messages. This should be fixed in IPC::Messaging.

AUTHOR ^

Anton Berezin <tobez@tobez.org>

LICENSE AND COPYRIGHT ^

Copyright (c) 2008, 2009, Anton Berezin <tobez@tobez.org>. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

syntax highlighting: