Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: help with Net::SFTP

by andyford (Curate)
on Jan 15, 2008 at 17:51 UTC ( #662516=note: print w/replies, xml ) Need Help??


in reply to help with Net::SFTP

First point: your code and errors don't match up. The "used only once" errors indicate that you are using "use strict", but your posted code doesn't show that.

To get help effectively, there can be no mismatch between your code and the errors!

Here's what you need to do: use "my" to fix your errors, don't drop "use strict", for example:

use strict; use warnings; use Net::SFTP; my $SFTPSite = 'sftp.xxxxbroker' ; my $userid = 'fred'; my $pword = 'bedrock'; #** ** ** ** ** ** ** ** # Setup to do the SFTP my $sftp = Net::SFTP->new( $SFTPSite, $userid, $pword ) or die "Could NOT create SFTP " ; #Net::SFTP const +ructor my @entries = $sftp->ls('/'); # slurp all entries into an array foreach $entry (@entries) { print "$entry \n"; chomp $entry; my @fields = split /\s+/, $entry; print "the file name: " . $fields[-1] . "\n"; }

Then post your complete code, preferably boiled down to the smallest working portion that demonstrates your problem.

Replies are listed 'Best First'.
Re^2: help with Net::SFTP
by kevind0718 (Scribe) on Jan 15, 2008 at 18:49 UTC
    I made the changes as you suggested, the new code follows:

    use strict; use warnings; use Net::SFTP; my $SFTPSite = 'sftp.xxxxbroker' ; my $userid = 'fred'; my $pword = 'bedrock'; my $entry = undef; #** ** ** ** ** ** ** ** # Setup to do the SFTP my $sftp = Net::SFTP->new( $SFTPSite, $userid, $pword ) or die "Could NOT create SFTP " ; #Net::SFTP const +ructor my @entries = $sftp->ls('/'); # slurp all entries into an array foreach $entry (@entries) { print "$entry \n"; chomp $entry; my @fields = split /\s+/, $entry; print "the file name: " . $fields[-1] . "\n"; }


    the following error message resulted from the above code.

    C:\dev\FTPPerl>perl testSFTP.pl The getpwuid function is unimplemented at c:/progFiles/PERL/site/lib/Net/SSH/Perl.pm line 110.

    I belive that I an missing something to support Net::SFTP. Maybe I have an old version of Net:SSH But do not know how to figure that out.
    As per the ActiveState Perl Package Manager I have the following SSH stuff installed:
    Net-SSH 0.08
    Net-SSH-Perl 1.30
    Net-SSH-W32-Perl .05

    thanks for your assistance.

    kd

      Looks like a deficiency in the Net::SSH::Perl or Net::SSH::W32Perl modules rather than a missing module. getpwuid doesn't exist on Win32, but Net::SSH::Perl is trying to call it.

      I wonder if Net::SSH::W32Perl is supposed to be some kind of helper to get around that.

      Perhaps try the example in the Net::SSH::W32Perl to see if it works by itself?

      Or take the easy-ugly-fast way and use system to shell out to a command line sftp client.

        thanks for your reply.
        As I suspected, this is a configuration or compatibility issue.

        Do any of the other kind monks have any ideas?
        Has anybody gotten SFTP to work under wondows?

        kd

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://662516]
help
Chatterbox?
[stonecolddevin]: Disciplus i was just amazed he's returned after the thorough stomp that BrowserUk and several other monks gave him for spreading crap info
[stonecolddevin]: i will admit i find the responses to his threads incredibly entertaining
[stonecolddevin]: erix what is this wizardy? there's no sound for me :-(
[stevieb]: he comes and goes every few years.
[erix]: stonecolddevin: oh? Don't know, it works for me
[Sinistral]: stonecolddevin / stevieb - would 'he' in this context (looked at last 50 lines and didn't see discussion) be a certain solar timepiece user?
[stonecolddevin]: Sinistral yes indeed
[Discipulus]: he does not learn, nor teach, nor learn

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2017-06-22 20:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (529 votes). Check out past polls.