Promise...d::Mojo(3)
β¨ NAME β¨
Promises::Deferred::Mojo β an implementation of Promises in Perl π (yes bestie, this is the Mojo-flavored one, it lives in the User Contributed Perl Documentation corner of your perldoc, and its manual page title is literally Promise...d::Mojo(3) because somebody at the terminal was being cute with truncation π
)
πΈ VERSION πΈ
version 1.05 β that's the vibe, that's the number, no cap.
π¦ SYNOPSIS π¦
use Promises backend => ['Mojo'], qw[ deferred collect ];
# ... everything else is the same
Like. That's it. That's the whole switch-up. Everything else stays exactly the same as whatever you were already doing, periodt. π
π DESCRIPTION π
okay so here's the tea β β the "Promise/A+" spec is strongly suggesting (like, it really wants this, it's giving main character energy) that the callbacks you hand to then should be run asynchronously, meaning they fire off in the next turn of the event loop. This module is the one that makes that happen, and it does it using the Mojo::IOLoop module. slay. π₯
So if you're a module author, bestie, listen β you should not care even a little bit about which event loop is gonna end up being used. Not your problem, not your business, don't worry about it. Just use the Promises module directly and let the universe sort out the backend:
package MyClass;
use Promises qw(deferred collect);
See? Clean. Iconic. No event loop named anywhere. π«Ά
And then the end users of the module β the people actually running the app β they get to pick which backend is in play at the very start of the application:
use Promises -backend => ['Mojo'];
use MyClass;
That's the whole thing. They say the word, the backend shows up, everyone's happy. β¨
β οΈ Note, and this one matters: if you are using Mojolicious with the EV event loop, then you should use the Promises::Deferred::EV backend instead. Do not come for this backend in that situation, fr fr. Use the EV one. π
π AUTHOR π
Stevan Little <stevan.little@iinteractive.com> β the author, the legend, the one who did this π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2025, 2017, 2014, 2012 by Infinity Interactive, Inc. π
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. So like, go forth, remix, redistribute, it's all above board bestie π
and that's the whole page, mwah π β this was Promise...d::Mojo(3) from perl v5.42.0, dated 2025-07-25, delivered to you with love, glitter, and zero skipped options because there weren't any options to skip π¦β¨π
π¦ where this page comes from
- fedora 43: perl-Promises 1.05-2.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms