Muskovitz has asked for the wisdom of the Perl Monks concerning the following question:
I want to make a Perl/Tk program that when a button gets clicked it'll execute a new thread. This is my very weird and junk code
Hope you could give me an advice.#!/usr/bin/perl use strict; use warnings; use threads; use threads::shared; use Tk; my $mw=new MainWindow; $mw->title("Command Executor"); my $cmd=$mw->Entry(); $mw->Button(-text=>"Execute",-command=>\&execThread())->pack(); MainLoop; sub execThread{ my $command=$cmd->get(); my $thr=threads->create(sub{ system("$command"); })->join; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl/tk execute thread when button clicked
by choroba (Cardinal) on Aug 21, 2015 at 10:38 UTC | |
|
Re: Perl/tk execute thread when button clicked
by Anonymous Monk on Aug 22, 2015 at 01:03 UTC |