http://qs321.pair.com?node_id=39953

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

I need for my Perl Script for Win32 to ftp to remote sites and download and upload various files - and while I can find some Net modules that I have grown to love in Unix, I can't find my dear Net::FTP! I assume it hasn't been ported yet - which is rather odd.

However, Net::Telnet has - and I was wondering if I could use some combinations of this and Unix scripting to run ftp from a Perl-simulated Telnet session. I'm kinda old-fashioned so I just use the old Unix 'ftp', and am not sure how I can make a script to handle automating that process since it's interactive (with a different prompt no less!) and not a batch process. This causes problems with FTP and my limited knowledge of scripting. Remember - Net::Telnet works by the timeout parameter and the shell character parameter - and these could both mess up FTP due to the fact that the Unix 'ftp' shell has it's own shell character and long file transfers would timeout.

Please help me! This is for a vital project of mine, and I know Perl masters out there must have encountered this before.

Harry Halpin

  • Comment on Can't use Win32 Perl to FTP - no Net::FTP for Win32?

Replies are listed 'Best First'.
Re: Can't use Win32 Perl to FTP - no Net::FTP for Win32?
by Adam (Vicar) on Nov 04, 2000 at 05:41 UTC
    By "ported" do you mean that ActiveState hasn't made a version for use with PPM? You can always just use CPAN directly:
    prompt> perl -MCPAN -e shell
      this requires "make" however and make is not standard on windows...

        Perl isn't standard on Windows either. And make is even easier to get (just one program to download) and is free. See one of the Win32 Perl FAQs for location.

                - tye (but my friends call me "Tye")
Re: Can't use Win32 Perl to FTP - no Net::FTP for Win32?
by Fastolfe (Vicar) on Nov 04, 2000 at 06:20 UTC
    According to the Net::FTP entry at CPAN, this module works fine with Win32. It's strange that you'd have some libnet modules but not others. There's nothing binary about Net::FTP; it's 100% Perl, so I don't know why this wouldn't work for you on your platform.

    Try digging a little deeper with ActiveState (if you're using ActiveState's Perl), or look into installing the module from CPAN.

Re: Can't use Win32 Perl to FTP - no Net::FTP for Win32?
by quidity (Pilgrim) on Nov 04, 2000 at 07:18 UTC

    Net::FTP works fine under Windows. Install it using the PPM supplied with the ActiveState install.

RE (tilly) 1: Can't use Win32 Perl to FTP - no Net::FTP for Win32?
by tilly (Archbishop) on Nov 04, 2000 at 14:22 UTC
    While I would (of course) recommend the portable solution, I once solved a similar problem by using Win32::Internet which is on ActiveState machines by default.
Re: Can't use Win32 Perl to FTP - no Net::FTP for Win32?
by the_slycer (Chaplain) on Nov 04, 2000 at 10:39 UTC
    Well, I know I've had to reinstall libnet on pretty much every binary distribution of perl that I've installed (including the default slack install). So you might try that. If worse comes to worse and you really can't get this working, I'm going to suggest a non-perlish solution (I know - blasphemy!) If you drop to a command prompt and type in ftp /? on an NT or 2000 box you will receive the list of switches. One of these switches is to read commands from a "script" (basically just a text file with the proper commands in order). I have made use of this with a batch file and the "at" command to do regularily scheduled ftp's.

    But really, try and reinstall the libnet module, there will be a prompt during that process for ftp, and I'll be you can get it working through that.
Re: Can't use Win32 Perl to FTP - no Net::FTP for Win32?
by chromatic (Archbishop) on Nov 04, 2000 at 23:14 UTC
    the_slycer is correct. I had to fix this very thing yesterday on an ActiveState installation on NT.

    Try ppm install libnet -- that worked for me.