Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

SFTP for Perl on CygWin

by pcrowley203 (Initiate)
on Jul 18, 2018 at 19:20 UTC ( [id://1218777]=perlquestion: print w/replies, xml ) Need Help??

pcrowley203 has asked for the wisdom of the Perl Monks concerning the following question:

I am running PERL 5.26.2 on CygWIN 2.9.0.0 on Windows 10. I need to execute an sftp from Perl. The base installation of perl doesn't seem to include sftp, so I downloaded and tried to install Net::SFTP. This seems to require Net::SSH2, which I also downloaded and tried to install. That seems to require crypt.h. In attempt to get crypt.h into place, I downloaded and tried to install gcrypt-0.3. Surprisingly, that too requires (and does not include) crypt.h. So I downloaded and tried to install Crypt-GCrypt-1.26. That seems to require the library 'gcrypt'. So I downloaded and tried to install libgcrypt-1.8.3. That requires libgptg-error-1.9, which I downloaded and tried to install. That will not compile because the compiler does not like a long series of lines all of the form: { , "GPG_ERR_SOMETHING"}

It doesn't seem like this should be so hard. Does anyone have any advice for me?

Replies are listed 'Best First'.
Re: SFTP for Perl on CygWin
by marto (Cardinal) on Jul 18, 2018 at 19:48 UTC

    Since you are working on windows have you considered Strawberry Perl? It ships with a sane development environment and many libraries, including Net::SSH2. Failing that you're going to have to be more specific about how you tried to install these things and what the failures are.

      while I second the Strawberry Perl recommendation, cygwin is a reasonably-"sane" development environment (though I haven't actively used it in years), and you should probably just have to install the appropriate development library. A quick search for "cygwin crypt.h" found this cygwin mailing list post, where it says you need to install the libcrypt-devel development library to get the headers/etc, and libcrypt0 for the DLL itself. A package search on cygwin does show those two packages exist.

      So, try to use cygwin's package manager for the libcrypt-devel and libcrypt0, and then see whether you can install the perl modules.

      I thought there might even be a package for properly installing Net::SSH2 and/or Net::SFTP ... but, not that I could find.

        I suggested Strawberry because it already includes all sorts of useful libraries and perl modules, including Net::SSH2. This made working on Windows so much easier for me, and given how easy it is to use I don't see any advantage of using perl via Cygwin. Perhaps someone has a special use case. Net::SFTP is a pure perl implementation.

        Thanks. So I installed the source for libcrypt-devel using the CygWin installer. I then found I had to further install Math::Int64, Net::SSH::perl, and Crypt::PRNG. Once all that was done, I could install Net::SSH2 and then Net::SFTP. Everything seemed to make, make test, and make install successfully with all of that. I run my script, and it still says "Can't locate Net/SFTP.pm in @INC (you may need to install the Net::SFTP module)" This seems strange to me, given that it seems successfully installed Net::SFTP. Any ideas? Thanks again.

Re: SFTP for Perl on CygWin
by choroba (Cardinal) on Jul 18, 2018 at 22:55 UTC
    Several years ago, I was able to use Net::SFTP::Foreign with cygwin. It uses external commands installed in the system, so if you have ssh installed, you should be OK.

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1218777]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-24 00:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found