# returns the new object sub init { my $sftp = shift; my %param = @_; $sftp->{debug} = delete $param{debug}; $sftp->{status} = SSH2_FX_OK; $param{ssh_args} ||= []; $param{ssh_args} = [%{$param{ssh_args}}] if UNIVERSAL::isa($param{ssh_args},'HASH'); $param{warn} = 1 if not defined $param{warn}; # default $sftp->{warn_h} = delete $param{warn} || sub {}; # false => ignore $sftp->{warn_h} = sub { carp $_[1] } # true => emit warning if $sftp->{warn_h} and not ref $sftp->{warn_h}; $sftp->{_msg_id} = 0; my $ssh = Net::SSH::Perl->new($sftp->{host}, protocol => 2, debug => $sftp->{debug}, @{ $param{ssh_args} }); $ssh->login($param{user}, $param{password}, 'supress_shell'); #line 62 $sftp->{ssh} = $ssh; my $channel = $sftp->_open_channel; $sftp->{channel} = $channel; $sftp->do_init; $sftp; }