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