in reply to Aborting ftp

Hello. Thanks for the replies. Yes I have used NET::FTP. Everything works fine but when a file is being downloaded there is no reply on the shell so that's why I try forking I don't use ctrl+c because I want my program to continue. Is there any way for get() to become silent or something? Sorry but I'm totally newbie. And sorry for the formatting

Replies are listed 'Best First'.
Re^2: Aborting ftp
by Marshall (Canon) on Dec 29, 2008 at 22:17 UTC
    I am a "newbie" too. But please confirm this:
    1) You don't need multiple processes downloading multiple files at the same time - correct? If you don't need to download multiple files at once, this is a huge simplification!
    2) It sounds like you run a program in a window and it becomes "stuck"? - e.g. you see no return prompt and it looks like the program hangs?
    Is that what is going on?
    3) If the above is correct, can you back up one step and tell me more about what you are trying to accomplish?

      Your assumptions are correct. I try to make an ftp client with NET::FTP. It's not that I have no prompt, The execution stucks on $ftp->get(). I just want to do other staff. I don't want to waste your time, I just want to know if I did something wrong or if it's just the case with get(). I thought that forking would allow me to read from STDIN. Thanks for your time so far.

        I think that the first reply to your post was on target. I have looked at the Net::FTP doc's and this appears to be "spot on". I suspect that your problem is at a much higher level than just getting the file. First, you have to authenticate and get logged-on. Follow the steps below.
        use Net::FTP; $ftp = Net::FTP->new("some.host.name", Debug => 1) or die "Cannot connect to some.host.name: $@"; $ftp->login("your_name",'password') or die "Cannot login ", $ftp->message; $ftp->cwd("remote_dir") #cwd at remote site may not #be necessary depending upon your logon. or die "Cannot change working directory ", $ftp->message; $ftp->get("somefilename") or die "get failed ", $ftp->message;
        Wish you well...
        Hi, I've been busy with things other than software for the past couple of days.

        I don't know what OS you have, but fork() on Windows is a mess! This doesn't work like on *NIX and is not transportable code.

        I would suggest getting this working from the command line first. "prompt> ftp -h" will display some not so helpful "help". Other ways: most browsers(IE,Firefox, etc) allow FTP://..someurl.. Also, I use WinSCP (a Windows program) for a lot of transfers to secure sites. This is freeware.

        Maybe you don't even need a Perl program at all?