@@ -28,22 +28,22 @@ want to ensure that only your code can keep or break the promise, you can use
28
28
the C < vow > method to get a unique handle, and call C < keep > or C < break > on it:
29
29
30
30
= begin code
31
- sub async-get-with-promise($user-agent, $url) {
32
- my $p = Promise.new;
33
- my $v = $p.vow;
34
-
35
- # do an asynchronous call on a fictive user agent,
36
- # and return the promise:
37
- $user-agent.async-get($url,
38
- on-error => -> $error {
39
- $v.break($error);
40
- },
41
- on-success => -> $response {
42
- $v.keep($response);
43
- }
44
- );
45
- return $p;
46
- }
31
+ sub async-get-with-promise($user-agent, $url) {
32
+ my $p = Promise.new;
33
+ my $v = $p.vow;
34
+
35
+ # do an asynchronous call on a fictive user agent,
36
+ # and return the promise:
37
+ $user-agent.async-get($url,
38
+ on-error => -> $error {
39
+ $v.break($error);
40
+ },
41
+ on-success => -> $response {
42
+ $v.keep($response);
43
+ }
44
+ );
45
+ return $p;
46
+ }
47
47
= end code
48
48
49
49
Further examples can be found in the L < concurrency page|/language/concurrency#Promises > .
@@ -83,7 +83,7 @@ Creates a new Promise that will be kept in C<$seconds> seconds, or later.
83
83
84
84
= head2 method at
85
85
86
- method at(Promise:U: $time , :$scheduler = $*SCHEDULER --> Promise:D)
86
+ method at(Promise:U: $at , :$scheduler = $*SCHEDULER --> Promise:D)
87
87
88
88
Creates a new Promise that will be kept at the given time, or later.
89
89
@@ -158,7 +158,7 @@ creates a chained promise.
158
158
Keeps a promise, optionally setting the result. If no result is passed, the
159
159
result will be C < True > .
160
160
161
- Throws an exception of type X::Promise::Vowed if a vow has already been
161
+ Throws an exception of type C < X::Promise::Vowed > if a vow has already been
162
162
taken. See method C < vow > for more information.
163
163
164
164
my $p = Promise.new;
@@ -178,7 +178,7 @@ taken. See method C<vow> for more information.
178
178
Breaks a promise, optionally setting the cause. If no cause is passed, the
179
179
cause will be C < False > .
180
180
181
- Throws an exception of type X::Promise::Vowed if a vow has already been
181
+ Throws an exception of type C < X::Promise::Vowed > if a vow has already been
182
182
taken. See method C < vow > for more information.
183
183
184
184
my $p = Promise.new;
0 commit comments