Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: help with Net::SFTP

by andyford (Curate)
on Jan 15, 2008 at 17:51 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://662516]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-19 05:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found