Commit | Line | Data |
47c83a13 |
1 | package Object::Remote::Connector::SSH; |
2 | |
84b04178 |
3 | use Object::Remote::ModuleSender; |
8ba4f2e3 |
4 | use Object::Remote::Handle; |
47c83a13 |
5 | use Moo; |
6 | |
a9fdb55e |
7 | with 'Object::Remote::Role::Connector::PerlInterpreter'; |
47c83a13 |
8 | |
fbd3b8ec |
9 | has ssh_to => (is => 'ro', required => 1); |
10 | |
498c4ad5 |
11 | has ssh_perl_command => (is => 'lazy'); |
12 | |
13 | sub _build_ssh_perl_command { |
14 | my ($self) = @_; |
15 | return [ 'ssh', '-A', $self->ssh_to, @{$self->perl_command} ]; |
16 | } |
17 | |
18 | sub final_perl_command { shift->ssh_perl_command } |
84b04178 |
19 | |
7efea51f |
20 | no warnings 'once'; |
21 | |
84b04178 |
22 | push @Object::Remote::Connection::Guess, sub { |
23 | for ($_[0]) { |
24 | # 0-9 a-z _ - first char, those or . subsequent - hostnamish |
a9fdb55e |
25 | if (defined and !ref and /^(?:.*?\@)?[\w\-][\w\-\.]/) { |
fbd3b8ec |
26 | return __PACKAGE__->new(ssh_to => $_[0]); |
84b04178 |
27 | } |
28 | } |
29 | return; |
30 | }; |
31 | |
47c83a13 |
32 | 1; |