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; }
In reply to Perl/tk execute thread when button clicked by Muskovitz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |