Hi Rob,

Hmmmm, true -- I may be adding and adding code unnecessarily... What the forked process does is run a C++ program and it is that program that needs to be timed. Would the code below accomplish that? I mean, having "times" in the Perl script that calls that C++ program will give the user time of that (spawned) Perl process. But that is a close enough estimation of the C++ program's user time provided all I do is run that program?

Also, this is within modperl/mason and I would like the parent process to be completely detached from the child (so that a web page can be shown) and not care when the child completes...

Ray



Rob Dixon wrote:
What do you need to accomplish that something as simple as the code below won't 
do?

Rob


use strict;
use warnings;

my $kid = fork;

if ($kid) {
  print "in parent whose kid is $kid\n";
}
elsif ($kid == 0) {
  print "In child\n";
  my ($usertime) = times;
  print "$usertime seconds\n";
}
else {
  die "Cannot fork: $!\n";
}




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to