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 | ||
a9fdb55e | 11 | around _perl_command => sub { |
fbd3b8ec | 12 | my ($orig, $self) = @_; |
13 | return 'ssh', '-A', $self->ssh_to, $self->$orig; | |
84b04178 | 14 | }; |
15 | ||
7efea51f | 16 | no warnings 'once'; |
17 | ||
84b04178 | 18 | push @Object::Remote::Connection::Guess, sub { |
19 | for ($_[0]) { | |
20 | # 0-9 a-z _ - first char, those or . subsequent - hostnamish | |
a9fdb55e | 21 | if (defined and !ref and /^(?:.*?\@)?[\w\-][\w\-\.]/) { |
fbd3b8ec | 22 | return __PACKAGE__->new(ssh_to => $_[0]); |
84b04178 | 23 | } |
24 | } | |
25 | return; | |
26 | }; | |
27 | ||
47c83a13 | 28 | 1; |