From: Matt S Trout Date: Thu, 12 Jul 2012 21:48:50 +0000 (+0000) Subject: add can::on X-Git-Tag: v0.001001~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=commitdiff_plain;h=624b459bafc411773708e674cf54e1971eb4d231 add can::on --- diff --git a/lib/Object/Remote.pm b/lib/Object/Remote.pm index fc6e955..485821d 100644 --- a/lib/Object/Remote.pm +++ b/lib/Object/Remote.pm @@ -10,6 +10,12 @@ sub new::on { return $conn->remote_object(class => $class, args => \@args); } +sub can::on { + my ($class, $on, $name) = @_; + my $conn = __PACKAGE__->connect($on); + return $conn->remote_sub(join('::', $class, $name)); +} + sub new { shift; Object::Remote::Handle->new(@_)->proxy; diff --git a/t/basic.t b/t/basic.t index b5a83b7..1547c96 100644 --- a/t/basic.t +++ b/t/basic.t @@ -29,7 +29,7 @@ is($remote->call_callback(27, sub { $x++ }), 27, "Callback ok"); is($x, 1, "Callback called callback"); is( - $connection->remote_sub('Sys::Hostname::hostname')->(), + Sys::Hostname->can::on($connection, 'hostname')->(), hostname(), 'Remote sub call ok' );