Skip to content

Commit

Permalink
mention promise states in the description
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 20, 2018
1 parent 57310d5 commit 8b3e17b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
30 changes: 30 additions & 0 deletions lib/Mojo/Promise.pm
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,36 @@ Mojo::Promise - Promises/A+
L<Mojo::Promise> is a Perl-ish implementation of
L<Promises/A+|https://promisesaplus.com>.
=head1 STATES
A promise is an object representing the eventual completion or failure of an
asynchronous operation. It allows asynchronous methods to return values, like
synchronous methods. But instead of immediately returning the final value, the
asynchronous method returns a promise to supply the value at some point in the
future.
A promise can be in one of three states:
=over 2
=item pending
Initial state, neither fulfilled nor rejected.
=item fulfilled
Meaning that the operation completed successfully.
=item rejected
Meaning that the operation failed.
=back
A pending promise can either be fulfilled with a value or rejected with a
reason. When either happens, the associated handlers queued up by a promise's
L</"then"> method are called.
=head1 ATTRIBUTES
L<Mojo::Promise> implements the following attributes.
Expand Down
7 changes: 2 additions & 5 deletions lib/Mojolicious.pm
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ sub build_tx {
return $tx;
}

sub config { Mojo::Util::_stash(config => @_); }
sub config { Mojo::Util::_stash(config => @_) }
sub defaults { Mojo::Util::_stash(defaults => @_) }

sub dispatch {
Expand Down Expand Up @@ -194,10 +194,7 @@ sub plugin {
$self->plugins->register_plugin(shift, $self, @_);
}

sub server {
my ($self, $server) = @_;
$self->plugins->emit_hook(before_server_start => $server, $self);
}
sub server { $_[0]->plugins->emit_hook(before_server_start => @_[1, 0]) }

sub start {
my $self = shift;
Expand Down

0 comments on commit 8b3e17b

Please sign in to comment.