Hi, > 2/ Every button click should invoke another perl script --> I > think I can do this by including the system command in the > button click method. If anyone knows any other sophisticated > method then pelase tell me
You can run your perl scripts using perl's do keyword: do 'myscript.pl'; However this may lead to problems, like if myscript.pl dies, your whole script will die. The very best way to handle it is to fork, as in my example below. The added advantage of forking is the script you started will run independently of your window script, so you dont have to wait for it to exit if you want to start another script running or do something else with the GUI. Here's how to do it: # Signal handler for when child threads die. # Probably not required on Win32. Put this near the top # of your script. sub REAPER {wait; $SIG{CHLD} = \&REAPER;} $SIG{CHLD} = \&REAPER; # # Your GUI code goes here. # # Example handler for a button called buttonA. # change 'myscript.pl' to whatever script you want to run. sub ::buttonA_Click { my $pid = fork; if(!defined($pid)) { die "Fork failed" }; if($pid == 0) { # This is the child thread do 'myscript.pl'; exit; # This quits our child. } } > 3/ I need to display the output while execution of each of > the scripts, that runs on a button click, on some sort of > box/window. This box or window can appear on the original > window or pop up a new one which would close once execution > finishes. that is : > I have a basic window with buttons. on click of button I > should see a text box or a pop up window which shows me the > result of the script execution. If its a pop up window it > should close when script finishes execution and if its a text > box then it can just stay as it is once the execution finishes. I > I have NO idea how to do this so any sort of help would be > great. I tried reading some tutorials on Win32::GUI but Im > still lost. Any advice/script snippets to start me off would > be much appreciated. The hardest part is capturing the output of your auxiliary scripts as they run. One way to do this is make a function in your GUI script that appends a line to a textfield somewhere. Let's say this function is called &logline() and takes an argument of $text. You can call the function from your external script (which we called 'myscript.pl' above) by using &MAIN::logline("some text"). This means replacing all those print statements with &MAIN::logline() instead. Steve