AnyEvent-ZeroMQ

 view release on metacpan or  search on metacpan

t/publish-subscribe.t  view on Meta::CPAN

# use this opportunity to ensure that push_read works as on_read does
$foobar->push_read(sub { $cv->end; push @{$results->{foobar}}, lc $_[1] });

# send data
$pub->publish('foo: no');
$pub->publish('bar: YES');
$pub->publish('qux: yes');
$pub->publish('gorch: yes');
$cv->recv;

# subscriptions updated and push_read works?
is_deeply $results, { foobar => [ map { "$_: yes" } qw/bar qux gorch/] },
    'subscriptions mirror $topics attribute';

done_testing;



( run in 0.551 second using v1.01-cache-2.11-cpan-0a6323c29d9 )