Any.pm

filter: Statementstmt 19.3% 37 / 191 Branchbran 0.0% 0 / 108 Conditioncond 0.0% 0 / 66 MC/DCmcdc 0.0% 0 / 36 Subroutinesub 31.0% 9 / 29 Podpod 84.6% 11 / 13 totaltotal 12.8% 57 / 443 CC 84 SCAR 55.5
CC
84
Cov
10%
_new
870.0
capture2
110.0
capture
90.0
CRAP 256.4
« Any/OS/_Base.pm ↑ Summary Any/Backend/Net_SSH2/SFTP.pm »
1 package Net::SSH::Any;
2  
3 4 our $VERSION = '0.10';
4  
5 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use warnings::register;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 ▶use Net::SSH::Any::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Net::SSH::Any::URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use Net::SSH::Any::Constants qw(:error);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 4 ▶use Scalar::Util qw(dualvar);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 4 ▶use Net::SSH::Any::_Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 4 our @ISA = qw(Net::SSH::Any::_Base);
17  
18 4 my $REQUIRED_BACKEND_VERSION = '2';
19 4 our @default_backends = qw(Net_OpenSSH Net_SSH2 Net_SSH_Perl Ssh_Cmd Plink_Cmd);
20  
21 0 ▶sub _new {
Subroutine _new: not called CC=29 SCAR=67.7
22 0 my ($class, $opts) = @_;
23 0 my $any = $class->SUPER::_new($opts);
24 0 ▶ $opts->{uri} // $opts->{host} // croak "either host or uri argument must be given";
Condition0%0/5
($opts->{"uri"} // $opts->{"host"}) // croak("either host or uri argument must be given")
l!l
00
$opts->{"uri"} // $opts->{"host"}
l!l&&r!l&&!r
000
MC/DC0%0/2
($opts->{"uri"} // $opts->{"host"}) // croak("either host or uri argument must be given")
$opts->{"uri"} $opts->{"host"}
Truth table0%0/3
A // B
A= $opts->{"uri"}B= $opts->{"host"}
ABresult
1X1
011
000
25 0 ▶ $opts->{password} //= delete $opts->{passwd};
Condition0%0/3
$opts->{"password"} //= delete $opts->{"passwd"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$opts->{"password"} //= delete $opts->{"passwd"}
$opts->{"password"} delete $opts->{"passwd"}
Truth table0%0/3
A //= B
A= $opts->{"password"}B= delete $opts->{"passwd"}
ABresult
1X1
011
000
26  
27 0 my @uri_opts = (port => 22);
28 0 ▶ if (defined (my $uri = delete $opts->{uri})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $uri = delete $opts->{"uri"})) 0 0 0
29 0 ▶ $uri = $uri->as_string if ref $uri and $uri->can('as_string');
Branch: 1 branch
BranchTrueFalseTotal
if ref $uri and $uri->can("as_string") 0 0 0
Condition0%0/3
ref $uri and $uri->can("as_string")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $uri and $uri->can("as_string")
ref $uri $uri->can("as_string")
Truth table0%0/3
A and B
A= ref $uriB= $uri->can("as_string")
ABresult
0X0
100
111
30 0 push @uri_opts, uri => $uri;
31 }
32 0 for (qw(host user port password passphrase)) {
33 0 ▶ if (defined (my $v = delete $opts->{$_})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $v = delete $opts->{$_})) 0 0 0
34 0 push @uri_opts, $_, $v;
35 }
36 }
37 0 my $uri = $any->{uri} = Net::SSH::Any::URI->new(@uri_opts);
38 0 ▶ unless ($uri) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($uri) 0 0 0
39 0 $any->_set_error(SSHA_CONNECTION_ERROR, "Unable to parse URI");
40 0 return $any;
41 }
42  
43 0 ▶ unless (defined $uri->user) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $uri->user) 0 0 0
44 0 ▶ if (defined (my $current_user = $any->_os_current_user)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $current_user = $any->_os_current_user)) { } 0 0 0
45 0 $uri->user($current_user);
46 }
47 else {
48 0 $any->_set_error(SSHA_UNIMPLEMENTED_ERROR, "Unable to infer login name");
49 0 return $any;
50 }
51 }
52  
53 0 ▶ if (defined (my $key_paths = delete $opts->{key_path} // delete $opts->{key_paths})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $key_paths = delete $opts->{"key_path"} // delete $opts->{"key_paths"})) 0 0 0
Condition0%0/3
delete $opts->{"key_path"} // delete $opts->{"key_paths"}
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $opts->{"key_path"} // delete $opts->{"key_paths"}
delete $opts->{"key_path"} delete $opts->{"key_paths"}
Truth table0%0/3
A // B
A= delete $opts->{"key_path"}B= delete $opts->{"key_paths"}
ABresult
1X1
011
000
54 0 $uri->or_set(key_path => _array_or_scalar_to_list($key_paths))
55 }
56  
57 0 ▶ $any->{io_timeout} = delete $opts->{io_timeout} // 120;
Condition0%0/2
delete $opts->{"io_timeout"} // 120
l!l
00
MC/DC0%0/1
delete $opts->{"io_timeout"} // 120
delete $opts->{"io_timeout"}
Truth table0%0/2
A
A= delete $opts->{"io_timeout"}
Aresult
11
00
58 0 $any->{timeout} = delete $opts->{timeout};
59 0 ▶ $any->{remote_shell} = delete $opts->{remote_shell} // 'POSIX';
Condition0%0/2
delete $opts->{"remote_shell"} // "POSIX"
l!l
00
MC/DC0%0/1
delete $opts->{"remote_shell"} // "POSIX"
delete $opts->{"remote_shell"}
Truth table0%0/2
A
A= delete $opts->{"remote_shell"}
Aresult
11
00
60 0 $any->{known_hosts_path} = delete $opts->{known_hosts_path};
61 0 ▶ $any->{strict_host_key_checking} = delete $opts->{strict_host_key_checking} // 1;
Condition0%0/2
delete $opts->{"strict_host_key_checking"} // 1
l!l
00
MC/DC0%0/1
delete $opts->{"strict_host_key_checking"} // 1
delete $opts->{"strict_host_key_checking"}
Truth table0%0/2
A
A= delete $opts->{"strict_host_key_checking"}
Aresult
11
00
62 0 ▶ $any->{compress} = delete $opts->{compress} // 1;
Condition0%0/2
delete $opts->{"compress"} // 1
l!l
00
MC/DC0%0/1
delete $opts->{"compress"} // 1
delete $opts->{"compress"}
Truth table0%0/2
A
A= delete $opts->{"compress"}
Aresult
11
00
63 0 $any->{backend_opts} = delete $opts->{backend_opts};
64 0 $any->{batch_mode} = delete $opts->{batch_mode};
65  
66 0 ▶ my @backends = _array_or_scalar_to_list(delete $opts->{backend} // delete $opts->{backends} // \@default_backends);
Condition0%0/5
(delete $opts->{"backend"} // delete $opts->{"backends"}) // \@Net::SSH::Any::default_backends
l!l
00
delete $opts->{"backend"} // delete $opts->{"backends"}
l!l&&r!l&&!r
000
MC/DC0%0/2
(delete $opts->{"backend"} // delete $opts->{"backends"}) // \@Net::SSH::Any::default_backends
delete $opts->{"backend"} delete $opts->{"backends"}
Truth table0%0/3
A // B
A= delete $opts->{"backend"}B= delete $opts->{"backends"}
ABresult
1X1
011
000
67 0 $any->{backends} = \@backends;
68  
69 0 for my $backend (@backends) {
70 0 $any->{error} = 0;
71 0 ▶ if ($any->_load_backend_module(__PACKAGE__, $backend, $REQUIRED_BACKEND_VERSION)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($any->_load_backend_module(__PACKAGE__, $backend, $REQUIRED_BACKEND_VERSION)) 0 0 0
72 0 ▶ $any->{backend} or croak "internal error: backend not set";
Branch: 1 branch
BranchTrueFalseTotal
$any->{"backend"} or croak("internal error: backend not set") 0 0 0
73 0 ▶ my %backend_opts = map { $_ => $any->{$_} // scalar($uri->get($_)) }
Condition0%0/2
$any->{$_} // scalar $uri->get($_)
l!l
00
MC/DC0%0/1
$any->{$_} // scalar $uri->get($_)
$any->{$_}
Truth table0%0/2
A
A= $any->{$_}
Aresult
11
00
74 qw(host port user password passphrase key_path timeout io_timeout
75 strict_host_key_checking known_hosts_path compress batch_mode);
76  
77  
78 0 ▶ if (my $extra = $any->{backend_opts}{$backend}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $extra = $any->{"backend_opts"}{$backend}) 0 0 0
79 0 @backend_opts{keys %$extra} = values %$extra;
80 }
81 defined $backend_opts{$_} or delete $backend_opts{$_}
82 0 ▶ for keys %backend_opts;
Branch: 1 branch
BranchTrueFalseTotal
defined $backend_opts{$_} or delete $backend_opts{$_} 0 0 0
83  
84 0 ▶ if ($any->_validate_backend_opts(%backend_opts)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($any->_validate_backend_opts(%backend_opts)) 0 0 0
85 0 $any->_connect;
86 0 return $any;
87 }
88 0 ▶ unless ($any->{error}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($any->{"error"}) 0 0 0
89 0 $any->_set_error(SSHA_BACKEND_ERROR, "internal error: _validate_backend_opts failed without setting the error");
90 }
91 0 $any->_log_error_and_reset_backend;
92 }
93 }
94 0 $any->_set_error(SSHA_NO_BACKEND_ERROR, "no backend available");
95 0 $any;
96 }
97  
98 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
99 0 my $class = shift;
100 0 ▶ my %opts = (@_ & 1 ? (uri => @_) : @_);
Branch: 1 branch
BranchTrueFalseTotal
@_ & 1 ? : 0 0 0
101 0 $class->_new(\%opts);
102 }
103  
104 0 ▶sub _clear_error {
Subroutine _clear_error: not called CC=5 SCAR=34.0
105 0 my $any = shift;
106 0 my $error = $any->{error};
107 0 ▶ return if ( $error and
Branch: 1 branch
BranchTrueFalseTotal
if $error and $error == 20 || $error == 21 || $error == 1 0 0 0
Condition0%0/9
$error and $error == 20 || $error == 21 || $error == 1
!ll&&!rl&&r
000
$error == 20 or $error == 21 or $error == 1
l!l&&r!l&&!r
000
$error == 20 or $error == 21
l!l&&r!l&&!r
000
MC/DC0%0/4
$error and $error == 20 || $error == 21 || $error == 1
$error $error == 20 $error == 21 $error == 1
Truth table0%0/5
A and B or C or D
A= $errorB= $error == 20C= $error == 21D= $error == 1
ABCDresult
0XXX0
10000
11XX1
101X1
10011
108 ( $error == SSHA_NO_BACKEND_ERROR or
109 $error == SSHA_BACKEND_ERROR or
110 $error == SSHA_CONNECTION_ERROR ) );
111 0 $any->{error} = 0;
112 0 1;
113 }
114  
115 0 ▶sub _quoter {
Subroutine _quoter: not called CC=4 SCAR=30.0
116 0 my ($any, $shell) = @_;
117 0 ▶ if (defined $shell and $shell ne $any->{remote_shell}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $shell and $shell ne $any->{"remote_shell"}) 0 0 0
Condition0%0/3
defined $shell and $shell ne $any->{"remote_shell"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $shell and $shell ne $any->{"remote_shell"}
defined $shell $shell ne $any->{"remote_shell"}
Truth table0%0/3
A and B
A= defined $shellB= $shell ne $any->{"remote_shell"}
ABresult
0X0
100
111
118 0 return $any->_new_quoter($shell);
119 }
120 0 ▶ $any->{quoter} //= $any->_new_quoter($any->{remote_shell});
Condition0%0/3
$any->{"quoter"} //= $any->_new_quoter($any->{"remote_shell"})
l!l&&r!l&&!r
000
MC/DC0%0/2
$any->{"quoter"} //= $any->_new_quoter($any->{"remote_shell"})
$any->{"quoter"} $any->_new_quoter($any->{"remote_shell"})
Truth table0%0/3
A //= B
A= $any->{"quoter"}B= $any->_new_quoter($any->{"remote_shell"})
ABresult
1X1
011
000
121 }
122  
123 0 ▶sub _delete_stream_encoding_and_encode_input_data {
Subroutine _delete_stream_encoding_and_encode_input_data: not called CC=7 SCAR=40.3
124 0 my ($any, $opts) = @_;
125 0 ▶ my $stream_encoding = $any->_delete_stream_encoding($opts) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $stream_encoding = $any->_delete_stream_encoding($opts) or return 0 0 0
126 0 ▶ $debug and $debug & 1024 and _debug("stream_encoding: "
Branch: 2 branches
BranchTrueFalseTotal
$Net::SSH::Any::debug and $Net::SSH::Any::debug & 1024 and _debug('stream_encoding: ' . ($stream_encoding ? $stream_encoding : "<undef>")) 0 0 0
$stream_encoding ? : 0 0 0
Condition0%0/3
$Net::SSH::Any::debug and $Net::SSH::Any::debug & 1024
!ll&&!rl&&r
000
MC/DC0%0/2
$Net::SSH::Any::debug and $Net::SSH::Any::debug & 1024
$Net::SSH::Any::debug $Net::SSH::Any::debug & 1024
Truth table0%0/3
A and B
A= $Net::SSH::Any::debugB= $Net::SSH::Any::debug & 1024
ABresult
0X0
100
111
127 . ($stream_encoding ? $stream_encoding : '<undef>') );
128 0 ▶ if (defined(my $data = $opts->{stdin_data})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $data = $opts->{"stdin_data"})) 0 0 0
129 0 my @input = grep defined, _array_or_scalar_to_list $data;
130 0 ▶ $any->_encode_data($stream_encoding => @input) or return;
Branch: 1 branch
BranchTrueFalseTotal
$any->_encode_data($stream_encoding, @input) or return 0 0 0
131 0 $opts->{stdin_data} = \@input;
132 }
133 $stream_encoding
134 0 }
135  
136 0 ▶sub _check_child_error {
Subroutine _check_child_error: not called CC=3 SCAR=24.8
137 0 my $any = shift;
138 0 ▶ $any->error and return;
Branch: 1 branch
BranchTrueFalseTotal
$any->error and return 0 0 0
139 0 ▶ if ($?) {
Branch: 1 branch
BranchTrueFalseTotal
if ($?) 0 0 0
140 0 $any->_set_error(SSHA_REMOTE_CMD_ERROR,
141 "remote command failed with code " . ($? >> 8)
142 . " and signal " . ($? & 255));
143 0 return;
144 }
145 0 return 1;
146 }
147  
148 4 _sub_options capture => qw(timeout stdin_data stderr_to_stdout stderr_discard
149 stderr_fh stderr_file);
150 0 ▶sub capture {
Subroutine capture: not called CC=9 SCAR=45.0
Pod documented
151 0 my $any = shift;
152 0 ▶ $any->_clear_error or return undef;
Branch: 1 branch
BranchTrueFalseTotal
$any->_clear_error or return undef 0 0 0
153 0 ▶ my %opts = (ref $_[0] eq 'HASH' ? %{shift()} : ());
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 0 0
154 0 ▶ my $stream_encoding = $any->_delete_stream_encoding_and_encode_input_data(\%opts) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $stream_encoding = $any->_delete_stream_encoding_and_encode_input_data(\%opts) or return 0 0 0
155 0 ▶ my $cmd = $any->_quote_args(\%opts, @_) // return;
Condition0%0/2
$any->_quote_args(\%opts, @_) // (return)
l!l
00
MC/DC0%0/1
$any->_quote_args(\%opts, @_) // (return)
$any->_quote_args(\%opts, @_)
Truth table0%0/2
A
A= $any->_quote_args(\%opts, @_)
Aresult
11
00
156 0 _croak_bad_options %opts;
157 0 ▶ my ($out) = $any->_capture(\%opts, $cmd) or return;
Branch: 1 branch
BranchTrueFalseTotal
my($out) = $any->_capture(\%opts, $cmd) or return 0 0 0
158 0 $any->_check_child_error;
159 0 ▶ if ($stream_encoding) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stream_encoding) 0 0 0
160 0 ▶ $any->_decode_data($stream_encoding => $out) or return;
Branch: 1 branch
BranchTrueFalseTotal
$any->_decode_data($stream_encoding, $out) or return 0 0 0
161 }
162 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) 0 0 0
163 0 my $pattern = quotemeta $/;
164 0 return split /(?<=$pattern)/, $out;
165 }
166 $out
167 0 }
168  
169 4 _sub_options capture2 => qw(timeout stdin_data);
170 0 ▶sub capture2 {
Subroutine capture2: not called CC=10 SCAR=47.0
Pod documented
171 0 my $any = shift;
172 0 ▶ $any->_clear_error or return undef;
Branch: 1 branch
BranchTrueFalseTotal
$any->_clear_error or return undef 0 0 0
173 0 ▶ my %opts = (ref $_[0] eq 'HASH' ? %{shift()} : ());
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 0 0
174 0 ▶ my $stream_encoding = $any->_delete_stream_encoding_and_encode_input_data(\%opts) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $stream_encoding = $any->_delete_stream_encoding_and_encode_input_data(\%opts) or return 0 0 0
175 0 ▶ my $cmd = $any->_quote_args(\%opts, @_) // return;
Condition0%0/2
$any->_quote_args(\%opts, @_) // (return)
l!l
00
MC/DC0%0/1
$any->_quote_args(\%opts, @_) // (return)
$any->_quote_args(\%opts, @_)
Truth table0%0/2
A
A= $any->_quote_args(\%opts, @_)
Aresult
11
00
176 0 _croak_bad_options %opts;
177 0 ▶ my ($out, $err) = $any->_capture2(\%opts, $cmd) or return;
Branch: 1 branch
BranchTrueFalseTotal
() = $any->_capture2(\%opts, $cmd) or return 0 0 0
178 0 $any->_check_child_error;
179 0 ▶ if ($stream_encoding) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stream_encoding) 0 0 0
180 0 ▶ $any->_decode_data($stream_encoding => $out) or return;
Branch: 1 branch
BranchTrueFalseTotal
$any->_decode_data($stream_encoding, $out) or return 0 0 0
181 0 ▶ $any->_decode_data($stream_encoding => $err) or return;
Branch: 1 branch
BranchTrueFalseTotal
$any->_decode_data($stream_encoding, $err) or return 0 0 0
182 }
183 0 ▶ wantarray ? ($out, $err) : $out
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
184 }
185  
186 4 _sub_options system => qw(timeout stdin_data stdin_file stdin_fh
187 stdout_fh stdout_file stdout_discard
188 stderr_to_stdout stderr_fh stderr_file stderr_discard
189 _window_size);
190 0 ▶sub system {
Subroutine system: not called CC=5 SCAR=34.0
Pod documented
191 0 my $any = shift;
192 0 ▶ $any->_clear_error or return undef;
Branch: 1 branch
BranchTrueFalseTotal
$any->_clear_error or return undef 0 0 0
193 0 ▶ my %opts = (ref $_[0] eq 'HASH' ? %{shift()} : ());
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 0 0
194 0 ▶ my $stream_encoding = $any->_delete_stream_encoding_and_encode_input_data(\%opts) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $stream_encoding = $any->_delete_stream_encoding_and_encode_input_data(\%opts) or return 0 0 0
195 0 ▶ my $cmd = $any->_quote_args(\%opts, @_) // return;
Condition0%0/2
$any->_quote_args(\%opts, @_) // (return)
l!l
00
MC/DC0%0/1
$any->_quote_args(\%opts, @_) // (return)
$any->_quote_args(\%opts, @_)
Truth table0%0/2
A
A= $any->_quote_args(\%opts, @_)
Aresult
11
00
196 0 _croak_bad_options %opts;
197 0 $any->_system(\%opts, $cmd);
198 0 $any->_check_child_error;
199 }
200  
201 4 _sub_options dpipe => qw(stderr_to_stdout stderr_discard subsystem);
202 0 ▶sub dpipe {
Subroutine dpipe: not called CC=4 SCAR=30.0
Pod undocumented
203 0 my $any = shift;
204 0 ▶ $any->_clear_error or return undef;
Branch: 1 branch
BranchTrueFalseTotal
$any->_clear_error or return undef 0 0 0
205 0 ▶ my %opts = (ref $_[0] eq 'HASH' ? %{shift()} : ());
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 0 0
206 0 ▶ my $cmd = $any->_quote_args(\%opts, @_) // return;
Condition0%0/2
$any->_quote_args(\%opts, @_) // (return)
l!l
00
MC/DC0%0/1
$any->_quote_args(\%opts, @_) // (return)
$any->_quote_args(\%opts, @_)
Truth table0%0/2
A
A= $any->_quote_args(\%opts, @_)
Aresult
11
00
207 0 _croak_bad_options %opts;
208 0 $any->_dpipe(\%opts, $cmd);
209 }
210  
211 4 _sub_options sftp => qw(fs_encoding timeout block_size queue_size autoflush write_delay
212 read_ahead late_set_perm autodie remote_sftp_server_cmd ssh1);
213 0 ▶sub sftp {
Subroutine sftp: not called CC=7 SCAR=40.3
Pod documented
214 0 my ($any, %opts) = @_;
215  
216 0 ▶ $opts{timeout} //= $any->{timeout} if defined $any->{timeout};
Branch: 1 branch
BranchTrueFalseTotal
if defined $any->{"timeout"} 0 0 0
Condition0%0/3
$opts{"timeout"} //= $any->{"timeout"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$opts{"timeout"} //= $any->{"timeout"}
$opts{"timeout"} $any->{"timeout"}
Truth table0%0/3
A //= B
A= $opts{"timeout"}B= $any->{"timeout"}
ABresult
1X1
011
000
217 0 ▶ $opts{fs_encoding} //= $any->_delete_argument_encoding(\%opts);
Condition0%0/3
$opts{"fs_encoding"} //= $any->_delete_argument_encoding(\%opts)
l!l&&r!l&&!r
000
MC/DC0%0/2
$opts{"fs_encoding"} //= $any->_delete_argument_encoding(\%opts)
$opts{"fs_encoding"} $any->_delete_argument_encoding(\%opts)
Truth table0%0/3
A //= B
A= $opts{"fs_encoding"}B= $any->_delete_argument_encoding(\%opts)
ABresult
1X1
011
000
218  
219 0 _croak_bad_options %opts;
220 0 ▶ $any->_load_module('Net::SFTP::Foreign') or return;
Branch: 1 branch
BranchTrueFalseTotal
$any->_load_module("Net::SFTP::Foreign") or return 0 0 0
221 0 ▶ if (my $sftp = $any->_sftp(\%opts)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $sftp = $any->_sftp(\%opts)) { } 0 0 0
222 0 ▶ if (my $error = $sftp->error) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $error = $sftp->error) 0 0 0
223 0 $any->_set_error(SSHA_SFTP_ERROR, 'Unable to start SFTP connection', $sftp->error);
224 0 return;
225 }
226 0 return $sftp;
227 }
228 else {
229 0 $any->_or_set_error(SSHA_SFTP_ERROR, 'Unable to start SFTP connection', 'Unknown error');
230 }
231 ()
232 0 }
233  
234 0 ▶sub _helper_delegate {
Subroutine _helper_delegate: not called CC=4 SCAR=30.0
235 0 my $any = shift;
236 0 my $class = shift;
237 0 ▶ $any->_load_module($class) or return;
Branch: 1 branch
BranchTrueFalseTotal
$any->_load_module($class) or return 0 0 0
238 0 ▶ my %opts = (ref $_[0] eq 'HASH' ? %{shift()} : ());
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 0 0
239 0 ▶ my $obj = $class->_new($any, \%opts, @_) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $obj = $class->_new($any, \%opts, @_) or return 0 0 0
240 0 $obj->run(\%opts);
241 }
242  
243 0 ▶sub _wait_ssh_proc {
Subroutine _wait_ssh_proc: not called CC=5 SCAR=34.0
244 0 my ($any, $proc, $timeout, $force_kill) = @_;
245 0 ▶ $force_kill //= $any->{_kill_ssh_on_timeout};
Condition0%0/3
$force_kill //= $any->{"_kill_ssh_on_timeout"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$force_kill //= $any->{"_kill_ssh_on_timeout"}
$force_kill $any->{"_kill_ssh_on_timeout"}
Truth table0%0/3
A //= B
A= $force_killB= $any->{"_kill_ssh_on_timeout"}
ABresult
1X1
011
000
246 0 ▶ if ($force_kill) {
Branch: 1 branch
BranchTrueFalseTotal
if ($force_kill) 0 0 0
247 0 ▶ $timeout = $any->{_timeout} unless defined $timeout;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $timeout 0 0 0
248 0 ▶ $timeout = 0 if $any->error == SSHA_TIMEOUT_ERROR;
Branch: 1 branch
BranchTrueFalseTotal
if $any->error == 4 0 0 0
249 }
250  
251 0 $any->_os_wait_proc($proc, $timeout, $force_kill);
252 }
253  
254 0 ▶sub scp_get { shift->_helper_delegate('Net::SSH::Any::SCP::Getter::Standard', @_) }
Subroutine scp_get: not called CC=1 SCAR=6.9
Pod documented
255 0 ▶sub scp_get_content { shift->_helper_delegate('Net::SSH::Any::SCP::Getter::Content', @_) }
Subroutine scp_get_content: not called CC=1 SCAR=6.9
Pod documented
256 0 ▶sub scp_mkdir { shift->_helper_delegate('Net::SSH::Any::SCP::Putter::DirMaker', @_) }
Subroutine scp_mkdir: not called CC=1 SCAR=6.9
Pod documented
257 0 ▶sub scp_put { shift->_helper_delegate('Net::SSH::Any::SCP::Putter::Standard', @_) }
Subroutine scp_put: not called CC=1 SCAR=6.9
Pod documented
258 0 ▶sub scp_put_content { shift->_helper_delegate('Net::SSH::Any::SCP::Putter::Content', @_) }
Subroutine scp_put_content: not called CC=1 SCAR=6.9
Pod documented
259  
260 0 ▶sub scp_find {
Subroutine scp_find: not called CC=1 SCAR=6.9
Pod undocumented
261 0 _warn("this feature is not finished yet");
262 0 shift->_helper_delegate('Net::SSH::Any::SCP::Getter::Finder', @_)
263 }
264  
265 0 ▶sub autodetect {
Subroutine autodetect: not called CC=3 SCAR=24.8
Pod documented
266 0 my $any = shift;
267 0 ▶ my $auto = $any->_helper_delegate('Net::SSH::Any::Autodetector', @_) // return;
Condition0%0/2
$any->_helper_delegate("Net::SSH::Any::Autodetector", @_) // (return)
l!l
00
MC/DC0%0/1
$any->_helper_delegate("Net::SSH::Any::Autodetector", @_) // (return)
$any->_helper_delegate("Net::SSH::Any::Autodetector", @_)
Truth table0%0/2
A
A= $any->_helper_delegate("Net::SSH::Any::Autodetector", @_)
Aresult
11
00
268 0 ▶ wantarray ? %$auto : $auto;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
269 }
270  
271 4 1;
272  
273 __END__
« Any/OS/_Base.pm ↑ Summary Any/Backend/Net_SSH2/SFTP.pm »