shan_emails has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks

I have one perl program in that, i need to run one watchfolderexe, and from that how can i come next line to debug/execute the program.

I am using exec "watchfolderexe"

But it won't come to nexe line to debug.

If i close "watchfolderexe" then only it comes to next line.

Please guide me how to proceed further.


Thanks in Advance,
Shanmugam A.

Replies are listed 'Best First'.
Re: how to come next line to debug
by moritz (Cardinal) on Nov 28, 2008 at 09:03 UTC
    exec never returns, as clearly stated in the documentation. Maybe you want system instead?
      foreach my $missingExe (@exeList){ chdir "d:\\exepath"; #change the path system(1, "$missingExe"); #for run the exe here 1 is for don' +t wait for next line to execute # $missingExe is the watch folder exe so it never ends }

      This coding runs fine but this program could not end, until or otherwise i manually close the exe's($missingExe). Then only i can end this program.

      So what can i do for this.

      Thanks in advance,
      Shanmugm A.
        If I understand your question correctly, it is "how do I run programs in the background?".

        This question has been asked many times here, and search for it should reveal many helpful replies.

Re: how to come next line to debug
by Anonymous Monk on Nov 28, 2008 at 09:05 UTC
    exec is the end of the program
    perldoc -f exec exec LIST exec PROGRAM LIST The "exec" function executes a system command *and never returns*-- use "system" instead of "exec" if you want it to