#!/usr/bin/perl -- use strict; use warnings; use threads; use Thread::Queue; ## how $guithread and $mechthread communicate my $DataQueue = Thread::Queue->new(); my $guithread = threads->create( sub { require MyApp::GUI; ## MyApp/GUI.pm MyApp::GUI::go(@_); ## uses timer to check on queue }, $DataQueue, ); my $mechthread = threads->create( sub { require MyApp::Mech; ## MyApp/Mech.pm MyApp::Mech::go(@_); }, $DataQueue, ); $guithread->join; ## wait for gui to finish