Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^10: Perl sftp behavior when there are no files in the share

by Bindo (Acolyte)
on Apr 05, 2013 at 11:51 UTC ( [id://1027126]=note: print w/replies, xml ) Need Help??


in reply to Re^9: Perl sftp behavior when there are no files in the share
in thread Perl sftp behavior when there are no files in the share

Appologies gentlemen that I was away. Well thank you everyone who have shared the thoughts towards my query. Mr Soonix no luck sir. Following is exactly what I tried, No progress is shown when I downloaded file :(.

print "Connecting to the sftp share! Please wait....!\n"; my $sftp = Net::SFTP::Foreign->new($LOG_HOST, user => +$REM_USER, password => $REM_PASSW); $sftp->setcwd($REM_PATH) or die "unable to change cwd: + " . $sftp->error; print "OK. On the share! Downloading the file \"$REM_F +ILE\"...................!\n\n\n"; $sftp->error and die "Problem connecting to the share. +..!!!! " . $sftp->error; # if ($sftp->get($REM_FILE)){ if ($sftp->get($REM_FILE, $REM_FILE, callback => \&sho +w_progress)) { print "File \"$REM_FILE\" downlaoded to ===> +\"$LOC_PATH$LOC_DIR\"\n\n"; } else { print "File \"$REM_FILE\" does not seem to hav +e been sent. Please re-request...!\n\n"; } sub show_progress { my($sftp, $data, $offset, $size) = @_; print "downloaded $offset of $size bytes\r";

Replies are listed 'Best First'.
Re^11: Perl sftp behavior when there are no files in the share
by soonix (Canon) on Apr 06, 2013 at 07:08 UTC

    But the files are transferred and the other print statements are executed?

    If I understand Net::SFTP::Foreign correctly, the callback function should be executed at least once per call to ->get.

    Maybe it is overwritten too quickly - what if you remove the \r or replace it with \n?

      Thanks again Mr Soonix. Yes sir files get downloaded with no problems. Will try what you suggested too and let you know. I think there is a problem with the net:sftp foreign with regard to it's call back feature. May be that is the reason I couldnt find a single person on the net who has gotten it to work.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1027126]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-25 22:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found