Navigation Menu

Skip to content

Commit

Permalink
format multiple closures consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 2, 2017
1 parent 0c513be commit b83ce9e
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions lib/Mojo/Promise.pm
Expand Up @@ -281,26 +281,30 @@ Appends fulfillment and rejection handlers to the promise, and returns a new
L<Mojo::Promise> object resolving to the return value of the called handler.
# Pass along the fulfillment value or rejection reason
$promise->then(sub {
my @value = @_;
say "The result is $value[0]";
return @value;
},
sub {
my @reason = @_;
warn "Something went wrong: $reason[0]";
return @reason;
});
$promise->then(
sub {
my @value = @_;
say "The result is $value[0]";
return @value;
},
sub {
my @reason = @_;
warn "Something went wrong: $reason[0]";
return @reason;
}
);
# Change the fulfillment value or rejection reason
$promise->then(sub {
my @value = @_;
return "This is good: $value[0]";
},
sub {
my @reason = @_;
return "This is bad: $reason[0]";
});
$promise->then(
sub {
my @value = @_;
return "This is good: $value[0]";
},
sub {
my @reason = @_;
return "This is bad: $reason[0]";
}
);
=head2 wait
Expand Down

0 comments on commit b83ce9e

Please sign in to comment.