Here is the code
#!/usr/bin/perl use Net::SFTP; print "Connecting...\n"; my $sftp = Net::SFTP->new('www.asd....', user=>'usead..', password=>'pass..') or die "could no +t open connection\n"; $sftp->ls("." , sub { print $_[0]->{longname}, "\n" }); my($stdout)=$sftp->status; print $stdout."\n"; print "Connected!\n"; $sftp->put("/var/tmp/prac/hi.txt",'/var') or die "...problem !..."; print "\nFinished\n";
output:
Connecting...
drwxr-xr-x 4 root root 512 Mar 25 01:33 ..
-rw-r--r-- 1 axadmin gadmin 66 Oct 26 2004 .profile
-rw-r--r-- 1 axadmin gadmin 283 Apr 26 2004 .tcshrc
-rwx------ 1 axadmin gadmin 265 Jan 28 04:48 .bash_profile
drwxr-xr-x 3 axadmin gadmin 512 Jan 28 23:55 asusmconf
0
Connected!
Couldn't get handle: Failure at sft.pl line 14
...problem !... at sft.pl line 14.
I can't able to use Net::SFTP::Foreign, as Foreign module is not available.
In reply to Re^2: Couldn't get handle : Failure at line 11,sftp a file in perl
by amchidam
in thread Couldn't get handle : Failure at line 11,sftp a file in perl
by amchidam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |