Promis...eferred(3pm)

πŸ’– NAME πŸ’–

Promise::XS::Deferred β€” it's the deferred object, bestie πŸ’…

(also it's a 3pm page, so like, Perl module docs, iykyk ✨)


πŸ¦‹ SYNOPSIS πŸ¦‹

okay so lowkey the synopsis is just:

See Promise::XS.

that's it. that's the whole vibe. go look at Promise::XS, she's the main character here πŸ‘‘


🌸 DESCRIPTION 🌸

so this class is the one that handles a promise's "producer" behavior β€” like, the part that actually makes the promise do stuff, not the part that sits around waiting for it πŸ™ˆ

do NOT instantiate this directly. fr fr. you don't new this one yourself, you get it via Promise::XS. that's the whole pipeline, no shortcuts ✨


πŸŽ€ BASIC METHODS πŸŽ€

these are the ones you need for, like, normal promise workflows. the everyday slay πŸ’–

  • $obj = OBJ->resolve( @ARGUMENTS ) β€” resolves OBJ's promise and hands it the given @ARGUMENTS as the value. returns OBJ 🫢
⚠️ IMPORTANT: behavior is not defined if literally anything in @ARGUMENTS is itself a promise. so like, don't do that. that's undefined behavior territory and we do not go there πŸ’€
  • $obj = OBJ->reject( @ARGUMENTS ) β€” same energy as resolve() but it rejects the promise instead. one of these days, am I right 😭

🌈 ADDITIONAL METHODS 🌈

the bonus round, the extra sprinkles πŸ“

  • $yn = OBJ->is_pending() β€” returns a boolean telling you whether the promise is still pending (as opposed to resolved or rejected). like, is she still cooking or is dinner served 🍳

normally you don't need this but it can be useful when you're debugging. it's giving detective energy πŸ”

and for compatibility with preexisting promise libraries, is_in_progress() exists as an alias for this exact same logic. two names, one girl. periodt πŸ’…

  • $obj = OBJ->clear_unhandled_rejection() β€” so ordinarily, if a promise's rejection is "unhandled", a warning about that unhandled rejection gets produced. call this after reject() to silence that warning πŸ”‡
(it's generally better, of course, to just handle all your errors. the warning is not the problem bestie, the unhandled rejection is πŸ™ˆ)

and that's the whole page!! this was perl v5.42.3, dated 2026-08-22, from the Promis...eferred(3pm) page (yes the title gets truncated in the header, we don't talk about it πŸ’€). mwah, go resolve some promises responsibly πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from