parallelise connection setup
[scpubgit/Object-Remote.git] / lib / Object / Remote / Connector / SSH.pm
CommitLineData
47c83a13 1package Object::Remote::Connector::SSH;
2
84b04178 3use Object::Remote::ModuleSender;
8ba4f2e3 4use Object::Remote::Handle;
47c83a13 5use Moo;
6
a9fdb55e 7with 'Object::Remote::Role::Connector::PerlInterpreter';
47c83a13 8
fbd3b8ec 9has ssh_to => (is => 'ro', required => 1);
10
a9fdb55e 11around _perl_command => sub {
fbd3b8ec 12 my ($orig, $self) = @_;
13 return 'ssh', '-A', $self->ssh_to, $self->$orig;
84b04178 14};
15
7efea51f 16no warnings 'once';
17
84b04178 18push @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 281;