Created
May 2, 2019 16:22
-
-
Save marcusramberg/c445646a81b73fcee6e77429bd12bfea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Mojo/Promise.pm b/lib/Mojo/Promise.pm | |
index 19fdd8617..a84ff6006 100644 | |
--- a/lib/Mojo/Promise.pm | |
+++ b/lib/Mojo/Promise.pm | |
@@ -2,6 +2,7 @@ package Mojo::Promise; | |
use Mojo::Base -base; | |
use Mojo::IOLoop; | |
+use Mojo::Util 'deprecated'; | |
use Scalar::Util 'blessed'; | |
has ioloop => sub { Mojo::IOLoop->singleton }, weak => 1; | |
@@ -67,7 +68,9 @@ sub map { | |
} | |
sub new { | |
- return shift->SUPER::new(@_) if @_ > 2 or ref($_[1]) eq 'HASH'; | |
+ deprecated('->new with attributes is DEPRECATED in favor of ->new->ioloop(..)') | |
+ && return shift->SUPER::new(@_) | |
+ if @_ > 2 or ref($_[1]) eq 'HASH'; | |
my $self = shift->SUPER::new; | |
shift->(sub { $self->resolve(@_) }, sub { $self->reject(@_) }) if @_; | |
return $self; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment