X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FObject%2FRemote%2FConnector%2FSSH.pm;h=73bc2fc2630ad7b775b8e49190fc0dde706db92e;hb=f425c3cb155190f7113bda4ad91d831662a2ac7a;hp=ed5218a85419dd4a1cc759cd661a371d214215e0;hpb=6ec765ba7875ca5d8d1dd63ce97d8c6dce38f407;p=scpubgit%2FObject-Remote.git diff --git a/lib/Object/Remote/Connector/SSH.pm b/lib/Object/Remote/Connector/SSH.pm index ed5218a..73bc2fc 100644 --- a/lib/Object/Remote/Connector/SSH.pm +++ b/lib/Object/Remote/Connector/SSH.pm @@ -2,6 +2,7 @@ package Object::Remote::Connector::SSH; use Object::Remote::ModuleSender; use Object::Remote::Handle; +use String::ShellQuote; use Moo; with 'Object::Remote::Role::Connector::PerlInterpreter'; @@ -16,10 +17,12 @@ has ssh_command => (is => 'ro', default => sub { 'ssh' }); sub _build_ssh_perl_command { my ($self) = @_; + my $perl_command = $self->perl_command; + return [ do { my $c = $self->ssh_command; ref($c) ? @$c : $c }, @{$self->ssh_options}, $self->ssh_to, - @{$self->perl_command} + shell_quote(@$perl_command), ]; } @@ -27,11 +30,12 @@ sub final_perl_command { shift->ssh_perl_command } no warnings 'once'; -push @Object::Remote::Connection::Guess, sub { +push @Object::Remote::Connection::Guess, sub { for ($_[0]) { # 0-9 a-z _ - first char, those or . subsequent - hostnamish if (defined and !ref and /^(?:.*?\@)?[\w\-][\w\-\.]/) { - return __PACKAGE__->new(ssh_to => $_[0]); + my $host = shift(@_); + return __PACKAGE__->new(@_, ssh_to => $host); } } return;