Release commit for 0.002002
[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
498c4ad5 11has ssh_perl_command => (is => 'lazy');
12
13sub _build_ssh_perl_command {
14 my ($self) = @_;
15 return [ 'ssh', '-A', $self->ssh_to, @{$self->perl_command} ];
16}
17
18sub final_perl_command { shift->ssh_perl_command }
84b04178 19
7efea51f 20no warnings 'once';
21
84b04178 22push @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 321;