Skip to content

Commit

Permalink
cloning a Mojo::Promise object was never really necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 2, 2018
1 parent 2805295 commit cde3711
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changes
Expand Up @@ -2,6 +2,8 @@
7.60 2018-01-02
- Deprecated use of Mojo::Promise::all and Mojo::Promise::race as instance
methods.
- Improved all and race methods in Mojo::Promise to be able to handle
arbitrary then-ables.
- Improved number detection in Mojo::JSON with a workaround for an upcoming
breaking change in Perl 5.28. (haarg)
- Improved HTML Living Standard compliance of Mojo::DOM::HTML.
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Promise.pm
Expand Up @@ -15,7 +15,7 @@ sub all {
and deprecated 'Use of Mojo::Promise::all as instance method is DEPRECATED'
if ref $class;

my $all = $promises[0]->_clone;
my $all = $class->new;

my $results = [];
my $remaining = scalar @promises;
Expand Down Expand Up @@ -54,7 +54,7 @@ sub race {
and deprecated 'Use of Mojo::Promise::race as instance method is DEPRECATED'
if ref $class;

my $new = $promises[0]->_clone;
my $new = $class->new;
$_->then(sub { $new->resolve(@_) }, sub { $new->reject(@_) }) for @promises;

return $new;
Expand Down

0 comments on commit cde3711

Please sign in to comment.