in reply to multithreading sample
Multithreading is necessary when you need separate computations to happen at the same time (e.g. on a multi-cpu machine) (*). Multithreading is occasionally useful when you have to monitor multiple different input streams or monitor an input stream while doing some complex calculations in the background. (Some people just don't like writing state machines or using POE) The problem you mention sounds nothing like either of these cases.
To approach the problem you mentioned, it seems to that the matter is simple: pull down some of the file, see if you've pulled down enough bytes to write another '#' mark, print it if so, and repeat. Of course, if you're using Net::FTP to pull the file down (you aren't rewriting your own ftp protocol, are you?) then another poster already mentioned the option that'll do that for you. If you're running an external ftp program in the background, I'd suggest that you need to read perlipc and consider inter-process communication, and then check if your ftp program has the ability to print out hash marks as it's working (many do).
(*) Yes, I'm aware that multithreading per se isn't the only way to split computations across multiple CPUs; obviously one can run entirely separate processes.
-- @/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/
|
|---|