in reply to question about objects / Net::SFTP
#!/usr/bin/perl use strict; use warnings; use Net::SSH2; use Net::SFTP::Foreign; use Net::SFTP::Foreign::Backend::Net_SSH2; my $host = 'localhost'; my $user = 'user'; my $pass = 'pass'; my $ssh2 = Net::SSH2->new(); $ssh2->debug(1); $ssh2->connect($host) or die "Connect failed!\n"; $ssh2->auth_password($user, $pass) or die "password auth failed\n"; my $sftp = Net::SFTP::Foreign->new(ssh2 => $ssh2, backend => 'Net_SSH2'); $sftp->error and die "Unable to establish a SFTP connection: ", $sftp->error; $sftp->put('/null.txt', '/root/Desktop/null.txt');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: question about objects / Net::SFTP
by salva (Canon) on Jan 28, 2011 at 20:51 UTC |