use strict; use Tk; use File::Spec; use threads; use Thread::Queue; my $RequestQ = Thread::Queue->new; my $worker = threads->new(\&worker); my $top = MainWindow->new(); my $menubar = $top->Menu(-type => 'menubar'); $top->configure(-menu => $menubar); my $filemenu = $menubar->cascade(-label => '~File', -tearoff => 0); $filemenu->command(-label => '~Report extract', -command => [\&report_extract], ); $filemenu->command(-label => 'E~xit', -command => [\&Shutdown], ); print STDERR "there's a tiny window open, it's small but it's there\n" +; MainLoop(); print STDERR "Exit Main loop \n"; ############################ sub Shutdown{ $RequestQ->enqueue(undef); # quit the worker $worker->join; print STDERR "FINISHED Shutdown\n"; exit; # Clean up Tk } ############################ sub report_extract { my $tmpdir = File::Spec->tmpdir(); open (F, ">$tmpdir\\xx.csv") || die $!; print F "aaa,bbb,ccc\nddd,eee,fff\n"; close F; my $cmd = "start $tmpdir\\xx.csv"; print STDERR "running $cmd\n"; $RequestQ->enqueue($cmd); } ################## sub worker{ while (my $target = $RequestQ->dequeue){ print STDERR "Request $target Read\n"; system $target; print STDERR "Finished target\n"; } print STDERR "Thread exit\n"; }
Offense, like beauty, is in the eye of the beholder, and a fantasy.
By guaranteeing freedom of expression, the First Amendment also guarantees offense.
In reply to Re: subprocess delay on Windows with Perl/Tk
by NetWallah
in thread subprocess delay on Windows with Perl/Tk
by kgoess
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |