From: Matt S Trout Date: Tue, 17 Jul 2012 23:25:39 +0000 (+0000) Subject: maybe::start X-Git-Tag: v0.002002~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9822fc762d19741060b1e731c405395938d810af;p=scpubgit%2FObject-Remote.git maybe::start --- diff --git a/lib/Object/Remote/Future.pm b/lib/Object/Remote/Future.pm index 04bc251..3392f68 100644 --- a/lib/Object/Remote/Future.pm +++ b/lib/Object/Remote/Future.pm @@ -48,6 +48,15 @@ sub AUTOLOAD { return $res; } +package maybe::start; + +sub AUTOLOAD { + my $invocant = shift; + my ($method) = our $AUTOLOAD =~ /^maybe::start::(.+)$/; + $method = "start::${method}" if ((caller(1)||'') eq 'start'); + $invocant->$method(@_); +} + package then; sub AUTOLOAD { diff --git a/t/start_core.t b/t/start_core.t index 4c63f4b..3b5aeae 100644 --- a/t/start_core.t +++ b/t/start_core.t @@ -22,6 +22,10 @@ use File::Spec; our $C; sub get_s2 { + shift->maybe::start::_real_get_s2; + } + + sub _real_get_s2 { future { my $f = shift; $C = sub { $f->done(S2F->new); undef($f); undef($C); };