Skip to content

Commit

Permalink
no need for wait to return its invocant
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 26, 2014
1 parent 438b748 commit bd545da
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/Mojo/IOLoop/Delay.pm
Expand Up @@ -35,13 +35,10 @@ sub steps {

sub wait {
my $self = shift;

return $self if $self->ioloop->is_running;
return if $self->ioloop->is_running;
$self->once(error => \&_die);
$self->once(finish => sub { shift->ioloop->stop });
$self->ioloop->start;

return $self;
}

sub _die { $_[0]->has_subscribers('error') ? $_[0]->ioloop->stop : die $_[1] }
Expand Down Expand Up @@ -260,7 +257,7 @@ not increment the active event counter or an error occurs in a callback.
=head2 wait
$delay = $delay->wait;
$delay->wait;
Start L</"ioloop"> and stop it again once an L</"error"> or L</"finish"> event
gets emitted, does nothing when L</"ioloop"> is already running.
Expand Down

0 comments on commit bd545da

Please sign in to comment.