Hi, Threading in Perl is arguably the weakest part of the language. I do know of successful implementations of a threaded win32::gui app, where one thread handles GUI interaction, while the other does all the "work". I think if you search the list you might be able to come across a couple of examples.
As an example of problems of a threaded perl application. Imagine you had an object that encapsulated logic to process a text file. The initial processing of this file takes a significant amount of time, so you want to use a threaded model where the GUI is handled in one thread while the processing of the object is in the other. All works well - however you can't share perl objects between threads (only scalars)...Our newly processed text file, is in one thread but can not be access directly - you have to use a storable to serialise the data and copy it across...which can make the whole exercise rather futile! Hope that is of some help... Cheers, jez. ----- Original Message ----- From: "Brad Smith" <[EMAIL PROTECTED]> To: <perl-win32-gui-users@lists.sourceforge.net> Sent: Wednesday, June 23, 2004 11:49 AM Subject: [perl-win32-gui-users] Working with threads > Yesterday, after finishing a gui, I started reading some old list postings > on threads. I looked over my application and found a part of the code > where I could test the threading (perl 5.8.x). Best part, it worked! > > I have been programming in Perl steadily for the past five years, and it > has quickly become my language of choice. Up until now, I have > proceeded in the linear fashion in which Perl works on win32, each task > performed must be performed sequentially. Of course, I have always > sacrificed speed and responsivity for versatility. > > Now, I would like to begin retrofitting some of my code to a threaded > model, in part. I thought a good solution would be to try it with a gui, > but I am stuck in my thinking, and have a few questions to ask, to gain > clarity: > > 1. When using threading with win32::gui, would/could I create a thread > for each gui component/object? For example, from my Master loop, > could I create a thread that held a Window and every button, textfield, > etc. contained inside the Window, while another thread held a Dialog > Box with all of it's components (textfields, buttons, etc.)? > > 2. If I can, from where do I control the Show() method? I tried > performing this from the Master Loop, but it said, of course, that my > $Window didn't exist. Then, I tried passing the Show() through the > thread (e.g. $sample_thread->$Window->Show();), but that didn't work > either. > > 3. Instead of placing the $Window in threading, do I place the functions > of $Window in the threading? > > 4. Does anyone have an example of threading with Win32::gui? > > If anyone is old enough to remember seeing their first Walkman (circa > 1980), that is the similar feeling I am having with win32::gui and > threads! For five years, I have used Perl for database processing, and > cgi. Two years ago, I discovered the power of OLE. Now, I am > revisiting GUI, and contemplating threads. Next, I might begin > considering myself to be a programmer! :) > > Brad Smith > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & Training. > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - > digital self defense, top technical experts, no vendor pitches, > unmatched networking opportunities. Visit www.blackhat.com > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Perl-Win32-GUI-Users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users