Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
improved subprocess method in Mojo::IOLoop to allow for easier role c…
…omposition
  • Loading branch information
kraih committed Dec 14, 2017
1 parent c3b309d commit ec7f9e0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Changes
@@ -1,7 +1,9 @@

7.59 2017-12-10
7.59 2017-12-14
- Changed Mojo::IOLoop::Client to only start a thread pool with
Net::DNS::Native on demand. (Grinnz)
- Improved subprocess method in Mojo::IOLoop to allow for easier role
composition.
- Fixed RFC 7230 compliance bug in Mojo::Message::Response. (jberger)

7.58 2017-12-02
Expand Down
3 changes: 2 additions & 1 deletion lib/Mojo/IOLoop.pm
Expand Up @@ -153,7 +153,7 @@ sub stream {
sub subprocess {
my $subprocess = Mojo::IOLoop::Subprocess->new;
weaken $subprocess->ioloop(_instance(shift))->{ioloop};
return $subprocess->run(@_);
return @_ ? $subprocess->run(@_) : $subprocess;
}

sub timer { shift->_timer(timer => @_) }
Expand Down Expand Up @@ -608,6 +608,7 @@ Get L<Mojo::IOLoop::Stream> object for id or turn object into a connection.
=head2 subprocess
my $subprocess = Mojo::IOLoop->subprocess(sub {...}, sub {...});
my $subprocess = $loop->subprocess;
my $subprocess = $loop->subprocess(sub {...}, sub {...});
Build L<Mojo::IOLoop::Subprocess> object to perform computationally expensive
Expand Down
2 changes: 1 addition & 1 deletion t/mojo/subprocess.t
Expand Up @@ -82,7 +82,7 @@ Mojo::IOLoop->delay(
sub {
my $delay = shift;
Mojo::IOLoop->subprocess(sub {1}, $delay->begin);
Mojo::IOLoop->subprocess(sub {2}, $delay->begin);
Mojo::IOLoop->subprocess->run(sub {2}, $delay->begin);
},
sub {
my ($delay, $err1, $result1, $err2, $result2) = @_;
Expand Down

0 comments on commit ec7f9e0

Please sign in to comment.