Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Async-Defer CPAN distribution.

Report information
The Basics
Id: 78180
Status: resolved
Priority: 0/
Queue: Async-Defer

People
Owner: Nobody in particular
Requestors: TOSHIOITO [...] cpan.org
Cc: powerman [...] powerman.name
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 0.9.0
Fixed in: (no value)



CC: powerman [...] powerman.name
Subject: Another way to finish a statement
Async::Defer's POD reads: Show quoted text
> While you can use both sync and async sub in do(), they all MUST > call one of done(), throw(), continue() or break() when they > finish their work
However, I think another way is possible: to call run() method of a child defer with $parent_defer being set, as in:: my $parent = Async::Defer->new(); $parent->do(sub { my ($d, @args) = @_; ... ## some processing my $child = Async::Defer->new(); $child->do( ... ); ## write some async program $child->run($d, @args_for_child); }); $parent->run(); The code dynamically creates a child defer and inserts it into the execution of the parent defer. This model is very similar to JSDeferred library for Javascript, in which returned child Deferred objects are executed between the parent's statements. In my opinion this way of finishing a statement is sometimes useful, thus worth noting in POD. ----- Toshio ITO debug.ito@gmail.com