Thanks for your insight. I also got a private email from another POE user
who is having the same problem with pooling Net::FTP connections. Just for
my own edification, I think I will use your notes and try all three methods
to see how they compare in elegance. 

Looking more closely at the _parent and _child handlers, It struck me that
extending POE::Session to include generic session pool management functions
could be very useful in my situation. Has anyone ever tried this before?
POE::Session::Pool just seems to be the obvious evolutionary step for me.

- MW

-----Original Message-----
From: Rocco Caputo [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 06, 2003 7:03 PM
To: [EMAIL PROTECTED]
Subject: Re: Non-blocking SSH in POE?


On Mon, Jan 06, 2003 at 01:59:18PM -0700, Wilkinson, Mike wrote:
> 
> Hello POE People, Long time POE list lurker here.
> 
> I'm trying to figure out a good way to use POE to manage an aggregate of
SSH
> connections to remote machines. I've been trying to use functions from
> Net::SSH::Perl because it does not shell out like Net::SSH does. However,
> I've run into a snafu that perhaps you can suggest a solution to.
> 
> The high level interface to Net::SSH::Perl does not offer a non-blocking
> interface, so currently I only have a choice of diving into the lower
> interface, or forking off processes using Wheel::Run. While the Wheel::Run
> methods works for me, it only offers limited IPC between parent and
> children. Since I want to be able to "reuse" SSH connections to a remote
> machine, This limits it's usefulness. Also, the reason I wanted to use POE
> in the first place was to avoid forking lots of processes. Therefore, I
> would rather like to be able find a simple way to do one of the following:
> 
> - Use Net::SSH::Perl's low level interface with POE in a non-blocking
> capacity (PoCo?),

You can use blocking I/O with POE as long as you use select_read() to
wait until the blocking operation is ready.  Once select_read() sends
you an event, your blocking read operation is usually assured to be
quickly satisfiable.

> - Extend Wheel::Run or my custom handlers to have better IPC functionalty
> (how?), or

It depends on the kind of IPC you're interested in.  In the past, I've
needed to use (Conduit => "pty") with ssh in order to get past the
password prompt.

> - Find a way to use Net::SSH::Perl's experimental open3() method with
> Poe::Wheel (seems broken).

This may be the best way.  If you have an experimental program using
this, broken or not, please e-mail it to me.  I'll see what can be
done.

In the meantime, try setting the input, output, and error handles from
the open3() method ->blocking(1) after giving them to
Wheel::ReadWrite.  That may be all you need to clear things up.

> Any suggestions? Are there any other solutions I've overlooked here?

-- Rocco Caputo - [EMAIL PROTECTED] - http://poe.perl.org/

Reply via email to