The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

EntityModel::Gather - asynchronous helper functions for EntityModel

VERSION

version 0.102

SYNOPSIS

 use EntityModel::Gather;

DESCRIPTION

Wrapper class for executing code once data values have been populated.

Given a set of data key => value pairs, this module will request population from each provider. Once all data values are available, the on_ready event is triggered, and the data values are passed to the provided handler. If it is impossible to retrieve data values for some reason, the on_error handler is called instead.

Each of the values passed must be one of the following:

  • Subclass of EntityModel::Pending - requests callback when data value has been populated

  • Subclass of EntityModel::EntityBase - requests callback when populated

  • Scalar value - this will be used as-is

  • undef - this will be used as-is

Any other value will cause the scalar handling to be used.

METHODS

new

Create a new instance. Takes a list of key, value pairs indicating which data values to wait for.

add_pending

Adds the given key and value to the pending list. If the value is immediately available (simple scalar, for example) then this will pass the value through immediately.

INHERITED METHODS

EntityModel::BaseClass

clone, dump, sap

AUTHOR

Tom Molesworth <cpan@entitymodel.com>

LICENSE

Copyright Tom Molesworth 2008-2011. Licensed under the same terms as Perl itself.