in reply to Problem with Net::FTP

You should try getting an FTP connection working manually and see what requirements you need to fulfil for that. For example, in many network setups (particularly if you're in a NATed network) you need to activate passive mode in your FTP connection. The sentence

As my institute uses proxy

sounds a bit suspicious to me, because there are many types of proxies for the various protocols (HTTP,STMP,FTP) and you don't seem to know which one your institute is using and whether it's being used to proxy FTP connections at all. It may be entirely transparent to you as the user or a SOCKS proxy. So I would recommend using the command line "ftp" utility and trying to get a working connection with that, trying out options until you achieve a result.

Having said that, there is a bug in the way you are trying to set the Firewall option, the line

my $ftp=Net::FTP->new("ftp.cpan.org","XXXX")

should be

my $ftp=Net::FTP->new("ftp.cpan.org",Firewall => "XXXX")

, maybe that solves your problem already.

<private pet rant>Whyohwhy is this option called "Firewall" in Net::FTP when it clearly refers to the proxy? A proxy is not a firewall nor the other way around! The fact that both are often implemented on the same machine does not mean they are equivalent, and confusing users (who are often confused enough of their own accord) further by using wrong terminology in the module is extremely regrettable</rant>


All dogma is stupid.

Replies are listed 'Best First'.
Re^2: Problem with Net::FTP
by cool (Scribe) on Jul 10, 2007 at 12:52 UTC
    Thanks tirwhan for explanation,
    Just wondering whether there is any way to check, whatype of proxy my institute is using?? Exactly same problem I am facing in configuring my CPAN.pm as well. There it seems to connect to ftp.cpan but then fails everytime. And one of the error messages it shows complain about user id and password. Now strange thing is, there is none. I can browse the net with any password. Also what do you mean by manual ftp??Do you mean I should try to ftp to some machine outside the campus?? or to cpan?? if cpan than shouln't I know IP address for cpan server
    For my firefox browser setting; HTTP, SSL, FTP , GOPHER are given same proxies (XXXX) (and port 3128) but SOCKS_host has been left blank. Does this gives any clue???
    Now as you understand my level of comfortability with these lingo (ftp/proxy/firewall) could you pl direct me to some online documentation. I tried a few times to get a feel of these things but often found documents hard to understand.
    I admire you patient. Thank you for all your help.
      Just wondering whether there is any way to check, whatype of proxy my institute is using?

      Yes, ask the resident system administrator :-). S/he should also be able to give you tips on how to configure your FTP connection setup.

      Also what do you mean by manual ftp?
      I meant you should try connecting with the command line "ftp" client (and I'm assuming you have that at your disposal, if you're on Windows this may not be the case, I have no idea), which allows you to set options like proxy and mode on the command line, thus allowing for easy testing of the requirements.

      For my firefox browser setting; HTTP, SSL, FTP , GOPHER are given same proxies (XXXX) (and port 3128) but SOCKS_host has been left blank. Does this gives any clue???

      This does seem to indicate that your institute runs an FTP proxy on that machine, and your code (with the change I made) should work. Have you tried turning on debugging, as rpanman suggested? If so, what's the output?

      could you pl direct me to some online documentation

      Just type "FTP firewall proxy" into Google and you'll find loads of documentation on the subject. The wikipedia entry on FTP might be another place to start


      All dogma is stupid.
        Yes tirwhan,
        I tried running it with rpanman's suggestion and pasted the message in reply to his node. Just to inform you, I am working on Linux OS.
Re^2: Problem with Net::FTP
by cool (Scribe) on Jul 10, 2007 at 12:57 UTC
    Thanks tirwhan for explanation,
    Just wondering whether there is any way to check, whatype of proxy my institute is using?? Exactly same problem I am facing in configuring my CPAN.pm as well. There it seems to connect to ftp.cpan but then fails everytime. And one of the error messages it shows complain about user id and password. Now strange thing is that I can browse the net without any password. Also please tell me what do you mean by manual ftp??Do you mean I should try to ftp to some machine outside the campus?? or to cpan?? if cpan than shouln't I know IP address for cpan server and also the file location there?
    For my firefox browser setting; HTTP, SSL, FTP , GOPHER are given same proxies (XXXX) (and port 3128) but SOCKS_host has been left blank. Does this gives any clue???
    Now as you understand my level of comfortability with these lingo (ftp/proxy/firewall) could you pl direct me to some online documentation. I tried a few times to get a feel of these things but often found documents hard to understand.
    I admire your patience. Thank you for all your help.