From: Mike S. <MikeSchroeder@DonorWare.com> - 2004-10-11 19:33:53
|
I did some more work on this and now have a fairly useful functional minimalpoe.pl example. 1) You need POE installed. 2) You need the POE::Loop::Wx module in your path somewhere (attached) This seems to run on both linux and win32 -- haven't tried under OS X yet. To save space, I stripped out the commenting on the regular wx minimal stuff, but tried to add more comments explaining what I'm doing with POE. Basically, each Wx frame runs as it's own POE session, created with the POEFrameWrapper->spawn statement. At this point, I still need a dummy POE session to keep POE alive, but I suspect having a "background" session that goes and polls for new data etc is not a bad thing. POE::Kernel->run(); is used to start things instead of the $app->MainLoop(); Most of the work is done in the POEFrameWrapper class -- it creates the frame and puts it inside a new POE Session. I also was able to get a basic event build_handler working (got the ideas from POCO:SubWrapper component). The cool thing about this event handler concept is that you can now let either the background session or another frame post events to a target frame. Ideas I plan to use this for: a) when submitting a change in one frame, force another frame to refresh, b) have the background session periodically poll a server for fresh data and then force a frame to refresh with the new data, etc. Perhaps there are better Wx ways of doing this, but I like the flexibility that POE gives on this... Mattia - would you be open to the POE::Loop::Wx module you did posted to the poe.perl.org site? Mike Schroeder wrote: >Nothing too fancy yet - but at least it works! ;^) > >Rename the POE-Loop-Wx.pm file to Wx.pm and put in path for POE/Loop/Wx.pm. > >My big question so far is if it is appropriate to continue coding as we have >been in Wx, and code in normal POE style for that side of things? That way >lets the two styles run in parallel under the same Loop. Or, should we >adapt our style to make the Wx calls be more POE "states"? For example, >should an EVENT just call a subref that does a POE yield? Or should we let >Wx continue to manage all of those things. > >More questions than answers so far, but hopefully this is helpful to you. > >Mike Schroeder > > > > >>-----Original Message----- >>From: wxp...@li... >>[mailto:wxp...@li...]On Behalf Of Simon >>Flack >>On Wed, 18 Aug 2004 07:27:06 -0600, Mike Schroeder wrote >> >> >>>On a slightly different topic, I found a post from Mattia of an initial >>>version of POE::Loop::Wx for those wanting to combine POE with >>>wxPerl. You could then use POE for many other non-blocking >>>interactions (poe.perl.org) So far I have invested a bit of time and >>>have the minimal.pl working with POE::Loop::Wx. I still need to do >>>some more complex examples, as well as some thinking about how POE >>>affects programming style in wxPerl. If anyone else some ideas or >>>examples, that would be great. I'd be happy to share anything I >>>have so far. >>> >>> >>Yes please. Funny, I was thinking about this a few weeks ago. I'd >>like to see >>some examples, even simple ones. >> >> |