Promise...nyEvent(3)

πŸ“¦
version 1.05 Β· 2 versions
, in fedora 43

πŸ’– Promises::Deferred::AnyEvent πŸ’–

okay so bestie, welcome to Promises::Deferred::AnyEvent, a page straight out of the User Contributed Perl Documentation collection. it's giving "promises but make it async" and honestly? we're obsessed. πŸ¦‹


✨ NAME ✨

Promises::Deferred::AnyEvent β€” an implementation of Promises in Perl. yes that's the whole name, no notes, it ate. πŸ’…


🌸 VERSION 🌸

version 1.05 ✨ (she's grown, she's thriving)


πŸŽ€ SYNOPSIS πŸŽ€

use Promises backend => ['AnyEvent'], qw[ deferred collect ];

# ... everything else is the same

lowkey the "everything else is the same" is the most iconic line in the whole file. main character energy fr fr. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜•: the "Promise/A+" spec is very strongly opinionated about the fact that the callbacks you hand over to then should run asynchronously β€” meaning in the next turn of the event loop, not right this second like some impatient little gremlin. πŸ™ˆ and this module? this module is the one that makes that happen, by using the AnyEvent module to do the actual async-ing. she's the backbone. the behind-the-scenes queen. πŸ‘‘

now here's the part where module authors need to chill: if you're writing a module, you should not be out here caring which event loop is gonna get used. that's not your business bestie, that's a runtime decision. just use the Promises module directly and let the universe handle it:

package MyClass;

use Promises qw(deferred collect);

see? no event loop opinions. so peaceful. so unbothered. 🧘

meanwhile, the end users of the module β€” the ones actually running the app β€” they get to pick the backend themselves at the start of the application, like they're choosing an outfit for the day:

use Promises -backend => ['AnyEvent'];
use MyClass;

and that's it, that's the whole vibe check. the user decides, the module doesn't have to know, everybody wins. πŸ’–


🌈 AUTHOR 🌈

Stevan Little <stevan.little@iinteractive.com> β€” absolute legend, thank you for your service πŸ«‘πŸ’œ


this software is copyright (c) 2025, 2017, 2014, 2012 by Infinity Interactive, Inc. ✨

and it's free software β€” you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. so go forth, remix, redistribute, slay. πŸ’…πŸŒΈ


and that's the whole page bestie!! this doc came to you from perl v5.42.0, dated 2025-07-25, and it lives in the Promises...nyEvent(3) slot of your manual. mwah πŸ’‹ take care of her, she's an icon. πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from