[tpm] Correction regarding my talk last night

Cees Hek ceeshek at gmail.com
Thu Oct 29 10:02:21 PDT 2015


Hi All,

Thanks for letting me speak on Mojolicious last night.  Just a correction
on something I said last night.  I received an email from Joel Berger who
watched the talks online today (Olaf and Dave, your efforts for getting the
TPM meetings online are not going to waste).

When I showed the example using the Delay object, I mentioned that you
could not guarantee the order in which your callbacks completed, and hence
the callback results that are sent to the next step were not guaranteed to
be in order.  This was incorrect.  The results are returned in the order in
which you started the callbacks.

The delay object knows which order the $delay->begin calls were made, and
even though the callbacks may finish in an unpredictable order, the delay
object ensures that the results as passed to the next step in the correct
order.

Also, Joel mentioned that nesting delay objects also works correctly.  This
is something that I wasn't sure if it was supported, but it is supported.
He provided the following example that shows this in action (inside one of
the steps of a delay object, he makes a call to a subroutine, and this
subroutine creates it's own delay object and uses it to make some non
blocking calls).

https://github.com/jberger/MojoForum/blob/master/lib/MojoForum/Helpers.pm

If anyone is interested in looking further into the Non-Blocking support in
Mojo, Joel's blog series on the subject is highly recommended:

Writing Non-Blocking Applications with Mojolicious: Part 1
<http://blogs.perl.org/users/joel_berger/2013/10/writing-non-blocking-applications-with-mojolicious-part-1.html>
Writing Non-Blocking Applications with Mojolicious: Part 2
<http://blogs.perl.org/users/joel_berger/2013/11/writing-non-blocking-applications-with-mojolicious-part-2.html>
Writing Non-Blocking Applications with Mojolicious: Part 3
<http://blogs.perl.org/users/joel_berger/2014/01/writing-non-blocking-applications-with-mojolicious-part-3.html>
Non-blocking Mojolicious apps are even easier now!
<http://blogs.perl.org/users/joel_berger/2014/07/non-blocking-mojolicious-apps-are-even-easier-now.html>

Cheers,

Cees Hek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20151029/50e9f1d9/attachment.html>


More information about the toronto-pm mailing list