Scott McCoy > AnyEvent-Blackboard-v0.4.2 > AnyEvent::Blackboard

Download:
AnyEvent-Blackboard-v0.4.2.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: v0.4.2   Source   Latest Release: AnyEvent-Blackboard-v0.4.10

NAME ^

AnyEvent::Blackboard - An extension of Async::Blackboard which uses AnyEvent for timeouts.

SYNOPSIS ^

  my $blackboard = AnyEvent::Blackboard->new();

  $blackboard->watch([qw( foo bar )], [ $object, "found_foobar" ]);
  $blackboard->watch(foo => [ $object, "found_foo" ]);

  # After 250ms, provide ``undef'' for ``foo''
  $blackboard->timeout(foo => 0.25);

RATIONALE ^

Async::Blackboard makes a fantastic synchronization component -- however, it does have the possible condition of allowing control to be abandoned due to a lack value. This subclass adds the functionality of timeouts on keys to ensure this doesn't happen.

ATTRIBUTES ^

default_timeout -> Num

Default timeout in (optionally fractional) seconds.

METHODS ^

timeout SECONDS, [ KEY, [, DEFAULT ] ]

Set a timer for N seconds to provide "default" value as a value, defaults to `undef`. This can be used to ensure that blackboard workflows do not reach a dead-end if a required value is difficult to obtain.

watch KEYS, WATCHER [, KEYS, WATCHER ]
watch KEY, WATCHER [, KEYS, WATCHER ]

Overrides Async::Blackboard only for the purpose of adding a timeout.

clone

Create a clone of this blackboard. This will not dispatch any events, even if the blackboard is prepopulated.

BUGS ^

None known.

LICENSE ^

Copyright © 2011, Say Media. Distributed under the Artistic License, 2.0.

syntax highlighting: