From william at knowmad.com Fri Aug 3 08:32:28 2007 From: william at knowmad.com (William McKee) Date: Fri, 3 Aug 2007 11:32:28 -0400 Subject: [Charlotte.PM] August Meeting plans Message-ID: <20070803153228.GE21856@knowmad.com> Perl Mongers, We had planned to hold a technical meeting this month to review 3 of the popular database ORMs--CDBI, DBIC and RoseDB. Unfortunately, the space we had hoped to use is not available for us. Unless someone has a suggestion for another location to hold a technical meeting*, I suggest we hold a social. Ideas or suggestions anyone? Thanks, William * needs overhead projector, internet and seating for up to 12 -- Knowmad Technologies W: http://www.knowmad.com P: 704.343.9330 From william at knowmad.com Thu Aug 16 14:25:08 2007 From: william at knowmad.com (William McKee) Date: Thu, 16 Aug 2007 17:25:08 -0400 Subject: [Charlotte.PM] What? It's the 3rd Thursday already?!? Message-ID: <20070816212508.GD724@knowmad.com> OK, so apparently tonite's meeting has escaped everyone else's notice as well as I haven't been dinged about what we're doing. Given the late date, I suggest we put it off to next month. We're *still* looking for a place to hold our technical meetings. If you know of a business or school who is willing to provide us with a room and projector for a couple hours, let me know. Stay tuned for next month and keep cool. William -- Knowmad Technologies W: http://www.knowmad.com P: 704.343.9330 From cfowler at outpostsentinel.com Fri Aug 17 07:05:50 2007 From: cfowler at outpostsentinel.com (Christopher Fowler) Date: Fri, 17 Aug 2007 10:05:50 -0400 Subject: [Charlotte.PM] Code inside Perl Tk Message-ID: <1187359550.3094.74.camel@shuttle.linxdev.com> Are there any Perl TK wizards here? I'm playing with Perl Tk to create a GUI that selects on many sockets and displays messages from remote servers. The problem I'm having is understanding where I need to execute my select loop. It seems all the examples I've looked at shows the building of the GUI and then the execution of 'MainLoop'. At that point I no longer have control of the program. Where would I actually place this pseudo code? sub monitor { while(1) { my @ready = $selector->can_read(); # Display messages... } } I tried placing it in a thread and then build GUI elements in that thread while MainLoop was running. Xlib did not like that much. $MW = MainWindow->new; ###################### # # Load any images and fonts # ###################### ZloadImages(); ZloadFonts (); #$MW->setTitle("SAM Alarm Services"); # Widget HList1 isa HList $ZWIDGETS{'HList1'} = $MW->HList()->grid( -row => 0, -column => 0, ); # Widget Frame1 isa Frame $ZWIDGETS{'Frame1'} = $MW->Frame()->grid( -row => 0, -column => 1, ); sub child { my $red = $ZWIDGETS{'HList1'}->ItemStyle( 'text', -foreground => '#800000'); my $sas = config(); foreach my $ref (keys %{$sas}) { my $c = undef; $ref = $sas->{$ref}; next unless uc($ref->{'a'}) eq 'TRUE'; my $tree = $ZWIDGETS{'HList1'}->addchild(''); $ZWIDGETS{'HList1'}->itemCreate( $tree, 0, -itemtype => 'text', -text => "$ref->{'n'}", -style => $red ); } while(1) { sleep 60; } } my $thread = threads->create("child",undef); $thread->detach(); ############### # # MainLoop # ############### MainLoop; My plan was to do all the network code in the whil(1) loop above. From red at criticalintegration.com Fri Aug 17 07:47:15 2007 From: red at criticalintegration.com (Redvers Davies) Date: Fri, 17 Aug 2007 10:47:15 -0400 Subject: [Charlotte.PM] Code inside Perl Tk In-Reply-To: <1187359550.3094.74.camel@shuttle.linxdev.com> References: <1187359550.3094.74.camel@shuttle.linxdev.com> Message-ID: <1187362035.9399.44.camel@csstsg3058> On Fri, 2007-08-17 at 10:05 -0400, Christopher Fowler wrote: > Are there any Perl TK wizards here? I'm not, but I may have an idea. > I'm playing with Perl Tk to create a GUI that selects on many sockets > and displays messages from remote servers. The problem I'm having is > understanding where I need to execute my select loop. It seems all the > examples I've looked at shows the building of the GUI and then the > execution of 'MainLoop'. At that point I no longer have control of the > program. The same is true of Gtk which is where my experience lies (although its been a fair few years since I've been active in that project). Gtk however has an events_pending and main_iteration which we use as follows: while (1) { you_select_stuff_here(); while (Gtk2->events_pending) { Gtk2->main_iteration; } } which does exactly as you'd expect. There may be similer methods in Tk.pm - Good luck. Red (Who really needs to go to a charlotte.pm meeting even if it is to say hi or do a talk on Gtk2.pm or OpenMoko). From cfowler at outpostsentinel.com Fri Aug 17 11:38:18 2007 From: cfowler at outpostsentinel.com (Christopher Fowler) Date: Fri, 17 Aug 2007 14:38:18 -0400 Subject: [Charlotte.PM] Code inside Perl Tk In-Reply-To: <1187362035.9399.44.camel@csstsg3058> References: <1187359550.3094.74.camel@shuttle.linxdev.com> <1187362035.9399.44.camel@csstsg3058> Message-ID: <1187375899.21734.2.camel@shuttle.linxdev.com> Here is a page that talks about MainLoop http://www.oreilly.com/catalog/mastperltk/chapter/ch15.html It appears that I might have to do my select() within a loop. I think this may make events block until the timeout on the select(). It appears I can not create threads that can update GUI elements. I'll have to try this and see what effect blocking forever in a select() does when I clock a button. It could just interrupt the select() and then even code will be processed On Fri, 2007-08-17 at 10:47 -0400, Redvers Davies wrote: > On Fri, 2007-08-17 at 10:05 -0400, Christopher Fowler wrote: > > Are there any Perl TK wizards here? > > I'm not, but I may have an idea. > > > I'm playing with Perl Tk to create a GUI that selects on many sockets > > and displays messages from remote servers. The problem I'm having is > > understanding where I need to execute my select loop. It seems all the > > examples I've looked at shows the building of the GUI and then the > > execution of 'MainLoop'. At that point I no longer have control of the > > program. > > The same is true of Gtk which is where my experience lies (although its > been a fair few years since I've been active in that project). Gtk > however has an events_pending and main_iteration which we use as > follows: > > while (1) { > you_select_stuff_here(); > while (Gtk2->events_pending) { > Gtk2->main_iteration; > } > } > > which does exactly as you'd expect. > > There may be similer methods in Tk.pm - Good luck. > > Red > (Who really needs to go to a charlotte.pm meeting even if it is to say > hi or do a talk on Gtk2.pm or OpenMoko).