On Thursday 27 May 2004 01:26 am, Harald Schneider wrote: > Added a retry counter to avoid an inifinite loop, when spamd is down: > > #----------------------------------------------------------------- > # MOD.start > #----------------------------------------------------------------- > # pass rest to spamc > #MOD my $checkedEmail=`spamc -f < $tmpFile`; > > my $delay = 0; > my $retry = 0; > my $checkedEmail; > do { > $checkedEmail = ''; > print "*** spamc delayed: $delay sec.\n" if ($delay > 0) && ($DEBUG > == 1); > sleep($delay); > open2(*SPAMC_R,*SPAMC_W,'spamc -f'); > print SPAMC_W $tmpFile; > close(SPAMC_W); > > my $bak = $/; > undef $/; > $checkedEmail = <SPAMC_R>; > close(SPAMC_R); > $/ = $bak; > $delay += 5; > $retry += 1; > last if $retry > 1000; > } while($checkedEmail !~ /X-Spam-Flag/gms ); > > #----------------------------------------------------------------- > # MOD.end > #----------------------------------------------------------------- > > --Harald
Harald - That's great. Will implement in one or two days. Many thanks. I normally replace something like this: > my $bak = $/; > undef $/; > $checkedEmail = <SPAMC_R>; > close(SPAMC_R); > $/ = $bak; with: $checkedEmail = do { local $/; <SPAMC_R>; }; close(SPAMC_R); That seems to work and saves precious keystrokes. (You see, I'm getting old, and I beleive that each person only has a certain number of keystrokes in their lifetime; I try to save each one I can so I don't run out ;) ). Also, 1000 retries at an average of 500 x 5 seconds each is 1000 x 500 x 5 = 2,500,000 seconds which is about 29 days! I think I'll drop the retry count down a bit. Aloha => Beau; - To unsubscribe from this list: send the line "unsubscribe xmail" in the body of a message to [EMAIL PROTECTED] For general help: send the line "help" in the body of a message to [EMAIL PROTECTED]