I am currently using Net::SFTP in order to run a perl program on Windows that connects to a linux server and uploads a file to the server. The thing is that this is being a pain when it come to public-key authorization. Also, openSSH is not maintained anyomre forcing me to use copSSH on Windows. This switch for some reason is causing me to get the error "No file name or directory". I tried to log on the the server in the terminal and discovered tha it does not like lls commands. I'm trying to fix this but this brings me to the real question. I am looking for a different way to achieve the above and was wondering how other perl programmers where achieving this. Also, I guess I will post the program code that I'm getting the error I mentioned above. I'm just going to post the transfer section of the script since its pretty long (I keep getting in trouble for my posts). I'm not sure where the problem is.
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: }

In reply to Connecting to a Server by deadpickle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.