$progress = 2; if( $progress == 2){ for(;;){ if( $progress == 0){last} } }
What do you expect this code snippet to do? I expect it to sit in the for (;;) loop forever, since there's nothing in the loop that would set $progress=0 - or is this a variable shared between threads? Anyways, such a tight loop which tests just one variable is a wonderful way to hog your machine's CPU.
Why are you testing $progress just after setting it? ....ah, now. This is some variable you can control from TK, right?
Searching... ah, this essentally is code you got from zentara as an answer to a previous post from you, with formatting gone wild.
Stripping all those $progress blocks (you could have done that before posting), what remains is this:
sub sftp{ $|++; while(1){ if($die == 1){ goto END }; if ( $go == 1 ){ my $seconds = 120; my %args = (host=>$server, user=>$user, timeout=>$seconds) +; my $sftp = Net::SFTP::Foreign->new(%args); if ($sftp->error){ goto line; } $sftp->put("$waylcl\\waytemp", "$wayrmt/waytemp"); if ($sftp->error){ goto line; } line: if($die == 1){ goto END }; undef $sftp; #close current sftp $go = 0; #turn off self before returning } else { sleep 1 } # sleep if $go == 0 } END: }
The second goto line; - apart from goto being bad practice - doesn't make any sense; shouldn't that be goto END ? Removing all that goto stuff, your code becomes
sub sftp{ $|++; while(1){ last if $die == 1; if ( $go == 1 ){ my $seconds = 120; my %args = (host=>$server, user=>$user, timeout=>$seconds) +; my $sftp = Net::SFTP::Foreign->new(%args); last if ($sftp->error); $sftp->put("$waylcl\\waytemp", "$wayrmt/waytemp"); last if ($sftp->error); last if $die == 1; undef $sftp; #close current sftp $go = 0; #turn off self before returning } else { sleep 1; } # sleep if $go == 0 } }
Now, the only relevant line I see is
$sftp->put("$waylcl\\waytemp", "$wayrmt/waytemp");
Does the directory $wayrmt exist on the remote server?
(I keep getting in trouble for my posts)
That's because you really make it difficult to help you.
Fix your code formatting, throw out stuff that isn't relevant. See How (Not) To Ask A Question.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re: Connecting to a Server
by shmem
in thread Connecting to a Server
by deadpickle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |