This will work, but wont solve the problem of the alarm exiting the loop
before the file has been totaly proccessed.
On Sat, 12 Jul 2003, Ramprasad wrote:
> [EMAIL PROTECTED] wrote:
> > I'm kind of new to Perl, so please forgive the question..
> >
> > I'm trying to use perl to read a file and then run a program using the
> > file. I also want to use the alarm(x) function to skip to the next entry
> > in the files if it times out. Here's what Ive go so far:
> >
> > open (TESTFILE, "< regression") || die "Can't open: regression_dgd\n";
> > open (LOGFILE, "> regression.log") || die "Can't open: regression.log\n";
> > print LOGFILE "\n\n\nStart of test run - $today1 $run\n";
> > while ($line = <TESTFILE>)
> > {
> > alarm(62);
> > print "Working...\n";
> > $start=time;
> > chomp($line);
> > $cmd = "/node.ulm_bx";
> > $full_line = join("",$line,$cmd);
> > $jobrun = `$run $full_line`;
> > print LOGFILE "$jobrun";
> > $end = time;
> > $totaltime = $end - $start;
> > print LOGFILE "Time for test:$totaltime sec's\n\n\n";
> > }
> > close (TESTFILE);
> > close (LOGFILE);
> >
> > It works fine, but when the alarm time gets exceeded, the script exits.
> > What I would like it to do is just go to the next line in the TESTFILE.
> >
> > Thanks for any input you can give me..
> >
> > Denis
> >
>
> Why dont you just reset the alarm after every run
> eg
>
> $jobrun = `$run $full_line`;
> alarm(0); # This will reset the alarm
> print LOGFILE "$jobrun";
>
> I dont know if this work, because anyway you were resetting the alarm
> in the next loop
>
> Ram
>
>
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]