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.

condvar -> AnyEvent::CondVar

A conditional variable to track dispatches. (optional)

When supplied, each dispatch group will be wrapped in calls to ``begin'' and ``end'' on condvar instance.

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.

found KEY

Wrap calls to ``found'' in condvar transaction counting, if a condvar is supplied. The side-effect is that dispatching is wrapped in conditional variable counting.

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.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 80:

=back without =over

Around line 206:

Non-ASCII character seen before =encoding in '©'. Assuming UTF-8