Hello everyone,

I've run into a big problem I can't seem to solve.  I found out the hard (and slow) 
way that attempt
select on file descriptors doesn't work under Win32.  I ended up finding this:
http:[EMAIL PROTECTED]/msg00623.html.  At first, I thought I 
was saved.
Indeed, using POE::Pipe::TwoWay at least SEEMED to make IO::Select->can_read work 
correctly.
However, when I run the code below, IO::Select->can_read always returns true in the 
while loop:

#-------snip-----------
        use IO::Select;
        use IPC::Open2;
        use IO::Handle;
        use IO::Socket;
        use POE::Pipe::TwoWay;

        #create pipe
        my ($a_read, $a_write, $b_read, $b_write) = POE::Pipe::TwoWay->new();

        #open aspell
        $pid = open2($a_read, $a_write, "aspell", "-a" );
        # print to aspell
        print $a_write "now is the time\n for all good men to ocme to the aid\n";
        close $a_write;

        #create select
        $sel = IO::Select->new($b_read);

        #what I really want to do (loops forever)

le($sel->can_read()){ 
                print <$a_read>;
        }
#-------snip-----------

Interestingly, it gets stuck in the while loop, but never actually prints anything out 
from the pipe.  I had initially thought this was because I should be calling 
IO::Handle->getln() to read from the pipe, but for some reason that refuses to work 
under any circumstances with the POE pipe (which AFAIK is a IO::Socket::INET, derived 
from IO::Handle where getline() lives)

To add insult to injury, if I replace the while loop with this code, I actually do end 
up with the first line of output being printed:
        
#-------snip-----------
        #this one actually seems to work (of course, only for the first line)
        if ($sel->can_read()){
                print <$a_read>;
        }
#-------snip-----------

Anyone have any idea what I'm doing wrong?  I'm really at the end of my rope on this 
one.  Switching over to a "real" operating system is simply not an option.

Thanks in advance for your advice

-Joel

Reply via email to