0

let's say I have three perl scripts:

perl_script_GUI.pl

perl_script_1.pl

perl_script_2.pl

I execute my GUI: "perl_script_GUI.pl", and from there I want to execute both other scripts simultaniously. I can do this by using:

my $command="perl perl_script_1.pl ";
if (system( [0,1,2], 'start cmd /k "'.$command.'"' ) != 0){
     print "There was a problem executing the the script";
}
$command="perl perl_script_2.pl ";
if (system( [0,1,2], 'start cmd /k "'.$command.'"' ) != 0){
     print "There was a problem executing the the script";
}

This executes each script in a new window and runs the scripts while I can do something in the GUI.

Is it possible to get the result of the script when it has finnished?

nck
  • 1,673
  • 16
  • 40
  • 1
    What is `system( [0,1,2], ...)`? What is the `[0,1,2]` supposed to do? – mob Mar 08 '18 at 15:55
  • @mob I reused old code and I'm not sure, I got it from here https://stackoverflow.com/questions/364842/how-do-i-run-a-perl-script-from-within-a-perl-script – nck Mar 08 '18 at 16:12
  • 1
    So that is the syntax of the `system` function from the `IPC::System::Simple` module. Is that what you are using? Or are you using the ordinary builtin `system` function? – mob Mar 08 '18 at 16:15
  • @mat I'm using the ordinary builtin system function with this sintax and it doesn't return any error and executes the scripts in a new window as expected. The problem is that I think It only sees if the new window has been opened correctly and not what happens in the script which is running in it. – nck Mar 08 '18 at 16:19

1 Answers1

0

Unclear if you are talking about inter-process communication there is lot of good information and examples at perlipc (https://perldoc.perl.org/perlipc.html). There is of also the use of message queues which is dependent on your OS. A simple solution would be to append to a file that is shared between the scripts.

Paul
  • 5
  • 3