.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Promise::XS::Deferred 3pm" .TH Promise::XS::Deferred 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Promise::XS::Deferred \- deferred object .SH SYNOPSIS .IX Header "SYNOPSIS" See Promise::XS. .SH DESCRIPTION .IX Header "DESCRIPTION" This class implements a promise’s “producer” behavior. It is not to be instantiated directly, but rather via Promise::XS. .SH "BASIC METHODS" .IX Header "BASIC METHODS" The following are what’s needed to implement normal promise workflows: .ie n .SS "$obj = \fIOBJ\fP\->resolve( @ARGUMENTS )" .el .SS "\f(CW$obj\fP = \fIOBJ\fP\->resolve( \f(CW@ARGUMENTS\fP )" .IX Subsection "$obj = OBJ->resolve( @ARGUMENTS )" Resolves \fIOBJ\fR’s promise, assigning the given \f(CW@ARGUMENTS\fR as the value. Returns \fIOBJ\fR. .PP \&\fBIMPORTANT:\fR Behavior here is \fBnot\fR defined if anything in \f(CW@ARGUMENTS\fR is itself a promise. .ie n .SS "$obj = \fIOBJ\fP\->reject( @ARGUMENTS )" .el .SS "\f(CW$obj\fP = \fIOBJ\fP\->reject( \f(CW@ARGUMENTS\fP )" .IX Subsection "$obj = OBJ->reject( @ARGUMENTS )" Like \f(CWresolve()\fR but rejects the promise instead. .SH "ADDITIONAL METHODS" .IX Header "ADDITIONAL METHODS" .ie n .SS "$yn = \fIOBJ\fP\->\fBis_pending()\fP" .el .SS "\f(CW$yn\fP = \fIOBJ\fP\->\fBis_pending()\fP" .IX Subsection "$yn = OBJ->is_pending()" Returns a boolean that indicates whether the promise is still pending (as opposed to resolved or rejected). .PP This shouldn’t normally be necessary but can be useful in debugging. .PP For compatibility with preexisting promise libraries, \f(CWis_in_progress()\fR exists as an alias for this logic. .ie n .SS "$obj = \fIOBJ\fP\->\fBclear_unhandled_rejection()\fP" .el .SS "\f(CW$obj\fP = \fIOBJ\fP\->\fBclear_unhandled_rejection()\fP" .IX Subsection "$obj = OBJ->clear_unhandled_rejection()" Ordinarily, if a promise’s rejection is “unhandled”, a warning about the unhandled rejection is produced. Call this after \f(CWreject()\fR to silence that warning. (It’s generally better, of course, to handle all errors.)