PrePAN

Sign in to PrePAN

PubSub::Tiny A tiny blocking pub/sub event implementation for perl

Good

Synopsis

use PubSub::Tiny;
my $pubSub = PubSub::Tiny->new;
$pubSub->subscribe('myEvent',sub { });
$pubSub->publish('myEvent','eventData');

Description

PubSub::Tiny is a tiny implementation of a pub/sub event system in perl. It's meant to allow decoupling within an application, and does not do any permanent storage, nor does it allow any kind of IPC.

Comments

Very uncertain about the namespace for it. PubSub doesn't exist, and just adding "Tiny" to a non-existing namespace seems a bit silly. Event::TinyPubSub or Event::PubSub perhaps, though I'm really not sure.
I agree with zerodogg: you should explore the Event:: namespace. Event::Notify seems to be similar to what you are proposing.

Also Mojo::EventEmitter (part of Mojolicious) is another simple publish/subscribe event system implemented is a simple way. And as it is based on objects, it does not rely on global variable.

Please sign up to post a review.