From: Matt S Trout Date: Tue, 29 Jul 2014 00:31:42 +0000 (+0000) Subject: use newer Future API, fix broken test X-Git-Tag: v0.003003~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=commitdiff_plain;h=bc06e92182c47337510900a0077079176200bfc0;hp=668343cde7e6339cca56c66a41defdd28327f224 use newer Future API, fix broken test --- diff --git a/Changes b/Changes index cf9b560..e5fa5af 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ + - Use newer Future API, fix broken test + 0.003002 - 2013-03-19 - Switch from CPS::Future to Future.pm diff --git a/Makefile.PL b/Makefile.PL index 4cd8800..9ecf353 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -11,7 +11,7 @@ WriteMakefile( Moo => 1.001, 'Module::Runtime' => 0, 'JSON::PP' => 0, - 'Future' => 0.10, + 'Future' => 0.29, 'MRO::Compat' => 0, # required to fatpack Moo 'Class::C3' => 0, # required to fatpack Moo 'String::ShellQuote' => 0, # required for ssh argument manipulation diff --git a/lib/Object/Remote/Future.pm b/lib/Object/Remote/Future.pm index 83aad96..966532f 100644 --- a/lib/Object/Remote/Future.pm +++ b/lib/Object/Remote/Future.pm @@ -99,8 +99,8 @@ sub AUTOLOAD { my $invocant = shift; my ($method) = our $AUTOLOAD =~ /^then::(.+)$/; my @args = @_; - return $invocant->and_then(sub { - my ($obj) = $_[0]->get; + return $invocant->then(sub { + my ($obj) = @_; return $obj->${\"start::${method}"}(@args); }); } diff --git a/t/start_core.t b/t/start_core.t index b50b9f3..cb2ed87 100644 --- a/t/start_core.t +++ b/t/start_core.t @@ -63,13 +63,17 @@ $ENV{OBJECT_REMOTE_TEST_LOGGER} = 1; my $res; -S1S->start::get_s2->then::get_s3->on_ready(sub { ($res) = $_[0]->get }); +my @keep; + +push @keep, + S1S->start::get_s2->then::get_s3->on_ready(sub { ($res) = $_[0]->get }); is($res, 'S3', 'Synchronous code ok'); undef($res); -S1F->start::get_s2->then::get_s3->on_ready(sub { ($res) = $_[0]->get }); +push @keep, + S1F->start::get_s2->then::get_s3->on_ready(sub { ($res) = $_[0]->get }); ok(!$S2F::C, 'Second future not yet constructed');