http://qs1969.pair.com?node_id=1227829

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

Hello, I need again some monks advise on which road I should walk to modify my code and perform a parallel operation. The code below is part of a small Tk UI. In this portion of the code, the program downloads information from the Web (using LWP::UserAgent and other modules). The results are stored in arrays which are used (they get merged) AFTER all data has been collected. Now the script works serially, which is fine. However, I would like - if possible - to perform the download in parallel so that I can save time while downloading.

#parallel should START here if ($UseDataOne eq 1){ @DataOne=GetDataOne(@TableParameters); } if ($UseDatatwo eq 1){ @Datatwo=GetDatatwo(@TableParameters); } if ($UseDataThree eq 1){ @DataThree=GetDataThree(@TableParameters); } if ($UseDataFour eq 1){ @DataFour=GetDataFour(@TableParameters); } #program should wait here till all 4 arrays are ready

I am totally new to parallel processing, I have tried to integrate subs::parallel but without success (no matter what I try I get always Too many arguments for subs::parallel::parallelize (this is surely due to my inexperience in integrating the module with the rest of the code). I have also read that with Tk parallel processing is not easy, so better ask for your opinion. Do you know any working examples that could help me better understand how to proceed (and that can be possibly used with Tk) ?