Skip to content

Commit 95a0de8

Browse files
author
Jan-Olof Hendig
committed
Changed formatting
1 parent 0f2dcd3 commit 95a0de8

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

doc/Type/Promise.pod6

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,22 @@ want to ensure that only your code can keep or break the promise, you can use
2828
the C<vow> method to get a unique handle, and call C<keep> or C<break> on it:
2929
3030
=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+
}
4747
=end code
4848
4949
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.
8383
8484
=head2 method at
8585
86-
method at(Promise:U: $time, :$scheduler = $*SCHEDULER --> Promise:D)
86+
method at(Promise:U: $at, :$scheduler = $*SCHEDULER --> Promise:D)
8787
8888
Creates a new Promise that will be kept at the given time, or later.
8989
@@ -158,7 +158,7 @@ creates a chained promise.
158158
Keeps a promise, optionally setting the result. If no result is passed, the
159159
result will be C<True>.
160160
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
162162
taken. See method C<vow> for more information.
163163
164164
my $p = Promise.new;
@@ -178,7 +178,7 @@ taken. See method C<vow> for more information.
178178
Breaks a promise, optionally setting the cause. If no cause is passed, the
179179
cause will be C<False>.
180180
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
182182
taken. See method C<vow> for more information.
183183
184184
my $p = Promise.new;

0 commit comments

Comments
 (0)