Promise::XS::Promise(3pm) User Contributed Perl Documentation Promise::XS::Promise(3pm)

Promise::XS::Promise - promise object

See Promise::XS.

This is Promise::XS’s actual promise object class. It implements these methods:

… which behave as they normally do in promise implementations.

Additionally, all() and race() may be used, thus:

    my $p3 = Promise::XS::Promise->all( $p1, $p2, .. );
    my $p3 = Promise::XS::Promise->race( $p1, $p2, .. );

… or, just:

    my $p3 = ref($p1)->all( $p1, $p2, .. );
    my $p3 = ref($p1)->race( $p1, $p2, .. );

… or even:

    my $p3 = $p1->all( $p1, $p2, .. );
    my $p3 = $p1->race( $p1, $p2, .. );

(Note the repetition of $p1 in these last examples!)

Subclassing this class won’t work because the above-named methods always return instances of (exactly) this class. That may change eventually, but for now this is what’s what.

2024-03-31 perl v5.38.2