[Israel.pm] alarm

Yossi.Itzkovich at ecitele.com Yossi.Itzkovich at ecitele.com
Mon Feb 7 03:12:10 PST 2005





Hi,

Why I never get the alarmHandler called even though time is out ?

eval
      {
             print "going to alarm $timeout.\n";
             local $SIG{ALRM} = sub { print "ALARM\n";die "alarm\n" };
             alarm $timeout;

             my $tail=File::Tail->new(name=>$file, interval=>1);
             while (defined (my $line=$tail->read()))
               {
                 #             print "line=$line";
                 if ($line=~ /$msg/)
                   {
                         alarm 0;
                         die "OK\n";
                   }
               }
      };

Thanks
Yossi




More information about the Perl mailing list