I'm attempting to watch two items with event, io and signal.
This should be simple but it isn't working the way I need it
to.  If I start the script below and immediately send a sigterm
the signal isn't caught and the sub doesn't execute.  My guess
is that the open is blocking for the first read on the pipe
to occur which is causing the signal to miss.  The program 
will catch the signal as long as the pipe has been read
at least once.  Where am I going wrong?  Any help will be 
greatly appreciated.

TIA
Travis

CODE----

#!/usr/local/perl561/bin/perl
use IO::File;
use Event;

$FIFO = "npipe";

unless (-p $FIFO){
  unlink $FIFO;
  system ('/sbin/mknod', $FIFO,'p');
}

sub shutdown {

  Event::unloop;
  print "Good Bye!\n";
  exit;

}

sub say_hello {

  $fd = $_[0]->w->fd;
  $fd->print("Hello\n");
  $fd->close;
  sysopen($fh,$FIFO,O_WRONLY);

}

$fh = new IO::File;
sysopen($fh,$FIFO,O_WRONLY);

Event->signal(signal=>'TERM',cb=>\&shutdown);
Event->io(fd=>$fh,cb=>\&say_hello, poll=>'w');

Event::loop;

In reply to Event-io and named pipes (ARGHHH:() by tgummels

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.