NAME

asynchronous::universal::ready - declare trivial UNIVERSAL::ready method

SYNOPSIS

# use asynchronous::universal::ready; # should be within async_foo
use async_foo; # some conformant async package (see CONFORMANCE)
my $deferred_foo = new async_foo 1,2,3;
until($deferred_foo->ready){
     ... # while waiting for our foo
};
print "Our foo is ready and it is $deferred_foo\n";

DESCRIPTION

This module adds a ready() method to the UNIVERSAL class, that returns a true value.

CONFORMANCE

In scenarios in which an asynchronous framework returns a placeholder object which becomes upgraded to a result object, multiple frameworks may peacefully coexist by using this module rather than each adding their own extension to UNIVERSAL.

return value of ready method in conformant packages

Conformant asynchronous packages, either deferred-asynchronous or fully asynchronous, contain ready methods which return false while they await results.

handling scalar containing package name

A conformant package's C<ready>
method checks to make sure that it is really working with a reference,
in case C<ready> is called on a scalar containing the name of the package.

BUGS

UNIVERSAL methods are not invoked on the undefined value, or on non-blessed references.

HISTORY

Early drafts of this module went through contortions to accomodate unrealistic scenarios concerning tied objects.

SEE ALSO

asynchronous::universal::set_callback

AUTHOR

David Nicol <davidnico@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2005 David Nicol

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.