sub run { my $q = shift; $q->enqueue('ready'); # # need to sleep or otherwise wait for the # spawner to read the queue # while (1) { my $cmd = $q->dequeue(); # # process the command; you'll need to # add a timer to come back and check it # } }