deadpickle has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; use Tk; use Net::SFTP::Foreign; use threads; use threads::shared; use Tk::Dialog; use Tk::LabFrame; my $user:shared = 'uas'; my $server:shared = 'updraft.unl.edu'; my $wayrmt:shared = '/home/uas/Scripts/WP'; my $waylcl:shared = 'C:\Documents and Settings\deadpickle\Desktop\GRRU +VI'; ........ #SFTP Transfer sub sftp{ $|++; while(1){ if($die == 1){ goto END }; if ( $go == 1 ){ $progress = 2; if( $progress == 2){ for(;;){ if( $progress == 0){last} } } my $seconds = 120; my %args = (host=>$server, user=>$user, timeout=>$seconds) +; my $sftp = Net::SFTP::Foreign->new(%args); if ($sftp->error){ $progress =8; if( $progress == 8){ for(;;){if($progress == 0){last}} goto line; } } $progress = 1; if( $progress == 1){ for(;;){ if( $progress == 0){last} } } $gone = 1; if( $gone == 1){ for(;;){ if( $gone == 0){last} } } $sftp->put("$waylcl\\waytemp", "$wayrmt/waytemp"); if ($sftp->error){ $progress =7; if( $progress == 7){ for(;;){if($progress == 0){last}} goto line; } } $progress = 6; if( $progress == 6){ for(;;){ if( $progress == 0){last} } } $progress = 3; if( $progress == 3){ for(;;){ if( $progress == 0){last} } } line: #if($go == 0){last} if($die == 1){ goto END }; undef $sftp; #close current sftp $go = 0; #turn off self before returning $progress = 0; }else { sleep 1 } # sleep if $go == 0 } END: }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Connecting to a Server
by shmem (Chancellor) on Jun 23, 2007 at 12:04 UTC | |
|
Re: Connecting to a Server
by quester (Vicar) on Jun 23, 2007 at 22:09 UTC | |
|
Re: Connecting to a Server
by deadpickle (Pilgrim) on Jun 25, 2007 at 19:42 UTC | |
by Asim (Hermit) on Jun 28, 2007 at 02:06 UTC |