I tried to achieve above using the snippet from CPAN Tk::ExecuteCommand
module but it gives me errors below when I execute any Perl program within the $ec->configure(-command
section.
Also, the window will be closed unexpectedly once the Perl job completed. The script works and will not be closed if I just print the text instead of command within the entry (as the line I commented out). I choose to use this Cpan program as I wanted 2 things:
- To show the system command and run result within the text widget.
- To have the "execute button" turn to "cancel" when a job is running so that user could have chances to cancel an ongoing job.
May I know how to achieve that?
Here is the error msg I get:
> /usr/bin/perl: symbol lookup error: /usr/pkgs/perl/5.14.1/lib64/module/default/x86_64-linux/auto/Proc/ProcessTable/ProcessTable.so: undefined symbol: pthread_once
[13] Exit 127 test1.pl
And here is the code I used:
#!/usr/bin/perl
use Tk;
use Tk::ExecuteCommand;
$ec = tkinit()->ExecuteCommand(
-command => '',
-entryWidth => 50,
-height => 10,
-label => '',
-text => 'Execute',
)->pack;
$ec->configure(-command => 'perl ./my_script.pl -wrapper wrapper_txt');
#$ec->configure(-command => 'Text line only');
$ec->execute_command;
$ec->update;
MainLoop;