File Coverage

blib/lib/Net/Async/Tangence/Client/via/sshexec.pm
Criterion Covered Total %
statement 5 17 29.4
branch 0 6 0.0
condition 0 6 0.0
subroutine 2 3 66.6
pod 0 1 0.0
total 7 33 21.2


line stmt bran cond sub pod time code
1             # You may distribute under the terms of either the GNU General Public License
2             # or the Artistic License (the same terms as Perl itself)
3             #
4             # (C) Paul Evans, 2010-2021 -- leonerd@leonerd.org.uk
5              
6             package Net::Async::Tangence::Client::via::sshexec 0.16;
7              
8 1     1   768 use v5.14;
  1         3  
9 1     1   4 use warnings;
  1         2  
  1         167  
10              
11             sub connect
12             {
13 0     0 0   my $client = shift;
14 0           my ( $uri, %args ) = @_;
15              
16 0           my @sshargs;
17 0 0 0       push @sshargs, "-4" if $args{family} and $args{family} eq "inet4";
18 0 0 0       push @sshargs, "-6" if $args{family} and $args{family} eq "inet6";
19              
20 0           my $host = $uri->authority;
21              
22 0           my $path = $uri->path;
23             # Path will start with a leading /; we need to trim that
24 0           $path =~ s{^/}{};
25              
26 0           my $query = $uri->query;
27 0 0         defined $query or $query = "";
28             # $query will contain args to exec - split them on +
29 0           my @argv = split( m/\+/, $query );
30              
31 0           return $client->connect_exec( [ "ssh", @sshargs, $host, $path, @argv ] );
32             }
33              
34             0x55AA;