Hrm..  didn't think of that ...  *heh*  Good idea ...

I'm gonna use the Proc::Daemon module though .. seems to do exactly what
I need without messing with forking directly...

On Mon, 2002-11-18 at 21:29, Steve Grazzini wrote:
> That's all more or less correct, but you're missing a fundamental 
> point: fork() and exec() are used *together* to run the external 
> program.
> 
>   #
>   # 1. create a new process with fork()
>   #
> 
>   defined (my $pid = fork)  
>     or die "couldn't fork: $!";
> 
>   #
>   # 2. run "something else" with exec()
>   #
> 
>   if ($pid == 0) {
>       exec $cmd, @args;
>       die "couldn't exec '$cmd': $!";
>   }
> 
> Since the exec() only happens in the child, the parent keeps
> running the Perl script.
> 
> -- 
> Steve
> 
> perldoc -qa.j | perl -lpe '($_)=m("(.*)")'
-- 
---------------------------
Jason H. Frisvold
Senior ATM Engineer
Penteledata Engineering
[EMAIL PROTECTED]
RedHat Certified - RHCE # 807302349405893
---------------------------
"Something mysterious is formed, born in the silent void. Waiting alone
and unmoving, it is at once still and yet in constant motion. It is the
source of all programs. I do not know its name, so I will call it the
Tao of Programming."

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to