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

Good day. I am attempting to upload an ascii file to an ftp server that does not support PASV. The problem here is I am not specifying PASV in my script, Net::FTP is pulling that out of its ass. Even when I specify PORT, it still sends the PASV command. WTF? How do I prevent this? Script:
use Net::FTP; $ftp = Net::FTP-> new('blah.com',Debug => 1); $ftp-> login('blah', 'blah'); $ftp->port(); $ftp->ascii(); $ftp->cwd('/Inventory'); $ftp->put($file); $ftp-> quit();
and resulting debugging report
Net::FTP>>> Net::FTP(2.77) Net::FTP>>> Exporter(5.62) Net::FTP>>> Net::Cmd(2.29) Net::FTP>>> IO::Socket::INET(1.31) Net::FTP>>> IO::Socket(1.30_01) Net::FTP>>> IO::Handle(1.27) Net::FTP=GLOB(0x1d5cec4)<<< 220 Blah ready... Net::FTP=GLOB(0x1d5cec4)>>> USER blah Net::FTP=GLOB(0x1d5cec4)<<< 331 Password required for blah. Net::FTP=GLOB(0x1d5cec4)>>> PASS .... Net::FTP=GLOB(0x1d5cec4)<<< 230 User blah logged in. Net::FTP=GLOB(0x1d5cec4)>>> PORT 67,139,145,121,9,34 Net::FTP=GLOB(0x1d5cec4)<<< 200 Port command successful. Net::FTP=GLOB(0x1d5cec4)>>> TYPE A Net::FTP=GLOB(0x1d5cec4)<<< 200 Type set to A. Net::FTP=GLOB(0x1d5cec4)>>> CWD /Inventory Net::FTP=GLOB(0x1d5cec4)<<< 250 CWD command successful. "/Inventory" i +s current directory. Net::FTP=GLOB(0x1d5cec4)>>> ALLO 278912 Net::FTP=GLOB(0x1d5cec4)<<< 200 ALLO Ok : 41139867648 bytes available. Net::FTP=GLOB(0x1d5cec4)>>> PASV Net::FTP=GLOB(0x1d5cec4)<<< 501 PASV not allowed. Net::FTP=GLOB(0x1d5cec4)>>> QUIT Net::FTP=GLOB(0x1d5cec4)<<< 221 Goodbye.

Replies are listed 'Best First'.
Re: Net::FTP Forcing PASV??
by BrowserUk (Patriarch) on Apr 16, 2012 at 22:26 UTC

    Add Passive => 0 to your constructor.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

      Nice! It works. Thank you.