1 package Object::Remote::Connector::SSH;
3 use Object::Remote::ModuleSender;
4 use Object::Remote::Handle;
5 use String::ShellQuote;
8 with 'Object::Remote::Role::Connector::PerlInterpreter';
10 has ssh_to => (is => 'ro', required => 1);
12 has ssh_perl_command => (is => 'lazy');
14 has ssh_options => (is => 'ro', default => sub { [ '-A' ] });
16 has ssh_command => (is => 'ro', default => sub { 'ssh' });
18 sub _build_ssh_perl_command {
20 my $perl_command = $self->perl_command;
23 do { my $c = $self->ssh_command; ref($c) ? @$c : $c },
24 @{$self->ssh_options}, $self->ssh_to,
25 shell_quote(@$perl_command),
29 sub final_perl_command { shift->ssh_perl_command }
33 push @Object::Remote::Connection::Guess, sub {
35 # 0-9 a-z _ - first char, those or . subsequent - hostnamish
36 if (defined and !ref and /^(?:.*?\@)?[\w\-][\w\-\.]/) {
38 return __PACKAGE__->new(@_, ssh_to => $host);