Maybe I'm missing something.. But when the alarm triggers, the program 
drops out of the loop.. I think this is normal, what I need is for the 
next line of the file to be read. I'm I wrong here?


On 14 Jul 2003, Ramprasad A Padmanabhan wrote:

> 
> On Sat, 2003-07-12 at 20:34, [EMAIL PROTECTED] wrote:
> 
> > This will work, but wont solve the problem of the alarm exiting the loop 
> > before the file has been totaly proccessed.
> > 
> 
> Seems to me  that it is exactly what is wanted
> 
> 
> 
> > 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
> > > 
> > > 
> > > 
> > > 
> > 
> 
> ----------------------------------------------------------------
> 
> NETCORE SOLUTIONS *** Ph: +91 22 5662 8000 Fax: +91 22 5662 8134
> 
> MailServ: Email, IM, Proxy, Firewall, Anti-Virus, LDAP
> Fleximail: Mail Storage, Management and Relaying
> http://netcore.co.in
> 
> Emergic Freedom: Linux-based Thin Client-Thick Server Computing
> http://www.emergic.com
> 
> BlogStreet: Top Blogs, Neighborhoods, Search and Utilities
> http://www.blogstreet.com
> 
> Rajesh Jain's Weblog on Technology: http://www.emergic.org
> ----------------------------------------------------------------
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to