in reply to Parallel downloading under Win32?

I've written a downloader that spawned wget.exe as an external process to do the actual downloading. As long as no or little feedback is needed, that's all you need:

system(1, 'wget.exe', $url, '-O', $target_filename) == 0 or warn "Couldn't launch wget: $!/$?";

You only need a loop to launch the processes and possibly check from time to time how many instances you've launched.

Replies are listed 'Best First'.
Re^2: Parallel downloading under Win32?
by Xenofur (Monk) on Apr 29, 2009 at 12:11 UTC
    I don't understand 'system' very well. The manual says that system makes the parent process wait for completion, which sounds to me like what backticks do. If that's the case, that's not exactly parallel.

    If I'm misunderstanding that and it makes it run parallel, I fail to see how i can check for feedback, as perldoc doesn't mention any return of a handle or any sort of access to information about whether the task is still running. How would i know when it's done and what its success was?
        I'm amazed that that kind of information is not in the description of the command itself. Anyhow, that being a Win32-specific thing means it's useless for me, as i don't want to lose Linux compatibility.
      How would i know when it's done and what its success was?

      Sounds like you want to launch these processes with Win32::Process's Create() function instead of system().

      Cheers,
      Rob
        Good suggestion, certainly a more sensible approach than system, but not really applicable for me. While I want this to be able to run under Win32, i do not want to lose ability to run it under Linux.