sub new::on {
my ($class, $on, @args) = @_;
- my $conn = use_module('Object::Remote::Connection')->new_from_spec($on);
+ my $conn = __PACKAGE__->connect($on);
return $conn->new_remote(class => $class, args => \@args);
}
Object::Remote::Handle->new(@_)->proxy;
}
+sub connect {
+ my ($class, $to) = @_;
+ use_module('Object::Remote::Connection')->new_from_spec($to);
+}
+
sub current_loop {
our $Current_Loop ||= Object::Remote::MiniLoop->new
}
)->proxy;
}
+sub connect {
+ my ($self, $to) = @_;
+ return await_future($self->send(
+ class_call => 'Object::Remote', 0, connect => $to
+ ));
+}
+
sub get_remote_sub {
my ($self, $sub) = @_;
my ($pkg, $name) = $sub =~ m/^(.*)::([^:]+)$/;
use Test::More;
use Sys::Hostname qw(hostname);
-use Object::Remote::Connector::Local;
use Object::Remote;
$ENV{PERL5LIB} = join(
':', ($ENV{PERL5LIB} ? $ENV{PERL5LIB} : ()), qw(lib t/lib)
);
-my $connection = Object::Remote::Connector::Local->new->connect;
+my $connection = Object::Remote->connect('-');
#$Object::Remote::Connection::DEBUG = 1;
-my $remote = Object::Remote->new(
- connection => $connection,
- class => 'ORTestClass'
-);
+my $remote = ORTestClass->new::on($connection);
isnt($$, $remote->pid, 'Different pid on the other side');