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

Oh wise and powerful Monks - I am new to this site and hoping very much you can help me. We have Perl installed on AIX 5.1 and we have a perl script that ftp's. Things have been happy happy for years (5 years to be exact). The server admin recently upgraded the server to AIX 5.1 maintenance level 8 and ftp broke. Things were fine at maintenance level 7. The server admin installed the latest LIBNET module obtained from cpan hoping that would resolve the issue but to no avail, FTP still just hangs. Althought backing off the maintenance level would solve the problem, this is not a long term solution. Any suggestions for what/where the problem might be? Much appreciation!! Lori

Replies are listed 'Best First'.
Re: Perl FTP Hanging
by ptum (Priest) on Oct 02, 2006 at 21:28 UTC

    Welcome to PerlMonks! :)

    You might start by posting the relevant portion of the code that attempts to perform the FTP operation ... and show us also any error messages which may have been produced by the script. You may also find the libnet FAQ handy.


    No good deed goes unpunished. -- (attributed to) Oscar Wilde
Re: Perl FTP Hanging
by Joost (Canon) on Oct 02, 2006 at 21:35 UTC
    Your problem is hard to pin down since you don't really provide enough information.

    It will probably help if you told us the current perl version, and the versions of relevant modules (and possibly the versions of the working perl/modules if they differ from the current ones). Also some example code and/or a clear as possible description of the problem would be handy. See also how (not) to ask a question.

    ps: if you have any of this information, just update your post.

Re: Perl FTP Hanging
by derby (Abbot) on Oct 02, 2006 at 22:00 UTC

    I don't have a real answer but I would bet that you need to place your ftp session into passive mode. The normal sign of needing passive mode is that you can connect to the site but any data transfer (list, get) just hangs.

    -derby
Re: Perl FTP Hanging
by Khen1950fx (Canon) on Oct 03, 2006 at 00:16 UTC
    I would start with the debugging script found in libnet FAQ:

    #!/your/path/to/perl use Net::FTP; my $ftp = new Net::FTP ($host, DEBUG=> 1); $ftp->login('user', 'password'); $ftp->quit;

    Next, I agree with derby that you need to get into passive mode. Using Net::Config, there are a couple ways of doing that. One, if you are behind a firewall, then set ftp_ext_passive to a true value. Second, if you're not behind a firewall, you can set ftp_int_passive to a true value. There's one more method. If you're behind a FTP proxy firewall, not an HTTP or SOCKS firewall, then ftp_firewall must be set to "hostname:port"(the port that the firewall listens to).