in reply to Calling a Program from a Program

I don't see the need for two programs from what you show, but assuming your design is correct fork will let you exec B

defined( my $foo = fork) or die $!; $foo or exec '/path/to/B', @parms;
That is enough if you are certain that B will run longer than the remainder of A. Otherwise you must prevent B from going zombie.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Calling a Program from a Program
by Lost_ego (Novice) on Jun 17, 2003 at 17:35 UTC
    Just for my clarification. $foo will capture a fork error if it occurs?
    I am not educated enough in perl to understand the logical or in
    $foo or exec ....

      The return value from fork has three states,

      • undef - meaning fork failed
      • 0 - meaning you're in the child process
      • true - meaning you're in the parent, and the numeric value is the pid of the child

      That's all documented in the perldoc linked by fork.

      After Compline,
      Zaxo