1 package Object::Remote::Connector::SSH;
3 use Object::Remote::FatNode;
4 use Object::Remote::ModuleSender;
5 use Object::Remote::Handle;
9 with 'Object::Remote::Role::Connector';
13 my $pid = open2(my $ssh_stdout, my $ssh_stdin, 'ssh', $_[0], 'perl', '-')
14 or die "Failed to start ssh connection: $!";;
15 print $ssh_stdin $Object::Remote::FatNode::DATA, "__END__\n";
16 return ($ssh_stdin, $ssh_stdout, $pid);
19 around connect => sub {
20 my ($orig, $self) = (shift, shift);
21 my $conn = $self->$orig(@_);
22 Object::Remote::Handle->new(
24 class => 'Object::Remote::ModuleLoader',
25 args => { module_sender => Object::Remote::ModuleSender->new }
32 $self->ssh_masters->{$on} ||= Net::OpenSSH->new($on);
35 push @Object::Remote::Connection::Guess, sub {
37 # 0-9 a-z _ - first char, those or . subsequent - hostnamish
38 if (defined and !ref and /^(?:.*?\@)?[\w\-][\w\-\.]*/) {
39 return __PACKAGE__->new->connect($_[0]);