Eric Lucas on Fri, 11 Apr 2003 09:35:28 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Linux FIFOs


I know why I don't write an EOF... I close the file handle.
That takes care of it for me :-P

Here is my write loop:

while (1) {
   open (FIFO, "> $FIFO") or die "ERROR: can't write fifo $FIFO $!" ;
   printf FIFO "$IdentString" ;    # preformatted "signature"
   printf FIFO "="x72 . "\n$quote[$ix]" ;  # actual quote
   close FIFO ;
   if ( $ix++ > ($count - 2)) { 
      $ix = 0 ; 
   } 
   sleep(1) ;
}


I step through the list rather than select randomly.  Hence, the $ix++

Eric

Quoting Eric Lucas <eric@lucii.org>:

> Martin:
> 
> I, too, have a script (perl natch') that rotates through a list of
> signature quotes.  It's not on this computer but IIRC I had to put
> a "sleep 1" after the script writes a signature to the FIFO.  
> Otherwise, I'd get a flood of signatures out of the FIFO.  
> Now, if I issue a "cat .signature" I get a single signature.  If I 
> issue a "cat .signature; cat .signature" then I get two signatures 
> one second apart.  
> 
> I figured I would not be interactively creating more than email per 
> second :-)
> 
> Although I don't do it, you might benefit by writing an EOF character
> after your signature.  That would ensure the reading process would 
> stop reading.  Come to think of it, I don't know why I don't write
> an EOF in my code... hummmmmmm.
> 
> HTH.
> 
> Eric
> 


-- 
Eric Lucas
----------
_________________________________________________________________________
Philadelphia Linux Users Group        --       http://www.phillylinux.org
Announcements - http://lists.netisland.net/mailman/listinfo/plug-announce
General Discussion  --   http://lists.netisland.net/mailman/listinfo/plug