Hello Ben, I am in a hurry and I am not so sure why you are evaling in there, but I definitely DO wonder why you are setting the alarm after what is the code that I imagine you want to time out ?
-Federico _________________________________________ -- "'Problem' is a bleak word for challenge" - Richard Fish Muad'Dib of Caladan (Federico L. Lucifredi)- Harvard University & BU http://metcs.bu.edu/~lucifred > -----Original Message----- > From: Ben Boulanger [mailto:[EMAIL PROTECTED] > Sent: Saturday, September 18, 2004 10:28 PM > To: [EMAIL PROTECTED] > Subject: [Boston.pm] Timing out a long process and retaining the output > > Hi everyone, > I'm having a hard time locating the solution to what I hope is a > common/simple problem. I'm trying to run a very lengthy process, stop it > about 60 seconds in and retain whatever output has been received at that > point. The process is samba-tng's rpcclient pulling back the eventlog of > a windows NT system. I've tried an eval, and for some reason it's not > timing that out. Anyone have any ideas? > > Code is below: > > #!/usr/bin/perl -w > use IO::Socket; > > STDOUT->autoflush(); > > my $test; > > $SIG{ALRM} = sub { print "$test\n"; die 'died in eval\n'; }; > > eval { > > open(CMD, "/usr/local/samba/bin/rpcclient -S 172.21.173.230 -U > administrator\%itv -c 'eventlog system'|grep -B 2 -A 7 -i dac960nt|grep -e > '[0-9],[0-9],[0-9]'|"); > > $test = "test."; > #my $total = 20; > > while (<CMD>) { > $test .= $_; > #$x++; > #if ($x = $total) { > # close(CMD); > #} > } > > print "$test"; > alarm(10); > }; > > -- > > A single conversation with a wise man is better than ten years of study. > > _______________________________________________ > Boston-pm mailing list > [EMAIL PROTECTED] > http://mail.pm.org/mailman/listinfo/boston-pm > _______________________________________________ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm

