RFC: AnyEvent::Handle with two non-duplex filehandles

Marc Lehmann schmorp at schmorp.de
Sun Apr 21 01:31:08 CEST 2013


On Sat, Apr 20, 2013 at 08:54:53PM +1200, Mark Lawrence <nomad at null.net> wrote:
> called via ssh, similar to the way git uses ssh as a transport
> mechanism. Communication with the server program therefore occurs via
> two separate file handles, one for reading and one for writing.

Can you explain where the requirement to use two handles comes from?
Normally, when communicating with ssh, one handle should suffice (reading
for ssh output, and writing for ssh input, plus maybe another read handle
for stderr). At least, it worked for me in the past.

> (sockets), but requires the use of two separate instances for the
> ssh-transport case. In my case (presumably a common one?) the read

I have yet to see a case where this problem occurs. I think for those
(presumably rare :) cases, using two ae handles for two perl handles is
quite natural.

> callbacks need to call write handle methods, and vice-versa, and
> keeping track of objects and reference loops is complex. 

I think using weak references or explicit ->destroy calls should take care
of these loops without too much effort.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the anyevent mailing list