POEx::PubSub::Types - Exported Types for use within POEx::PubSub


POEx-PubSub documentation Contained in the POEx-PubSub distribution.

Index


Code Index:

NAME

Top

POEx::PubSub::Types - Exported Types for use within POEx::PubSub

VERSION

Top

version 1.102740

DESCRIPTION

Top

This modules exports the needed subtypes, coercions, and constants for PubSub and is based on Sub::Exporter, so see that module for options on importing.

TYPES

Top

PublishType

The publish type constraint applied to Events. Can either be PUBLISH_INPUT or PUBLISH_OUTPUT

Subscriber

When manipulating subscribers in an Event, expect to receive a well formed hash with the keys 'session' and 'event' corresponding to the subscribers SessionID and their event handler, respectively

CONSTANTS

Top

PUBLISH_OUTPUT

This indicates the Event is an output event

PUBLISH_INPUT

This indicates the Event is an input event

AUTHOR

Top

Nicholas Perez <nperez@cpan.org>

COPYRIGHT AND LICENSE

Top


POEx-PubSub documentation Contained in the POEx-PubSub distribution.

package POEx::PubSub::Types;
BEGIN {
  $POEx::PubSub::Types::VERSION = '1.102740';
}

#ABSTRACT: Exported Types for use within POEx::PubSub


use Moose;
use MooseX::Types -declare => [ 'PublishType', 'Subscriber' ];
use MooseX::Types::Moose('Int', 'Str');
use MooseX::Types::Structured('Dict');
use POEx::Types(':all');


use constant PUBLISH_OUTPUT => 2;
use constant PUBLISH_INPUT  => -2;

use Sub::Exporter -setup => { 
    exports => 
    [ 
        qw/ 
            PublishType 
            Subscriber 
            PUBLISH_INPUT 
            PUBLISH_OUTPUT 
        /
    ] 
};


subtype PublishType,
    as Int,
    where { $_ == -2 || $_ == 2 },
    message { 'PublishType is not PublishInput or PublishOutput' };


subtype Subscriber,
    as Dict[session => SessionID, event => Str];

1;




__END__