[Phoenix-pm] Looking for ideas - Perl Telnet Monitor

Andrew Johnson aj at exiledplanet.org
Wed Jun 29 19:33:45 PDT 2005


On Wed, 2005-06-29 at 19:54 -0500, Metz, Bobby W, WCS wrote:
> [snip]
> IO, i.e. it looks like regular send/expect stuff to me.  Anyone out
> there ever do anything like this or know of some easy Perl trick to
> monitor bi-dir IO on a TTY or Net:Telnet session without completing
> taking control from the user typing.  I'm sure the solution is staring
> me in the face, but right now it eludes me.

bidirectional IO that _doesn't_ take control from the user typing.
Well, no.  But you might try IPC::Open2 (I suppose you could capture
your prog's STDIN and feed it to the telnet process, and pass back
anything that is read from the telnet process's stdout handle).   Check
out Chapter 16 (Interprocess Communcation), section 3.3 (Bidirectional
Communication) of /Programming Perl/.  Since standard I/O buffering is
probably going to "ruin your day" (the Camel's quote), you might also
find IO::Select and the IO::Pty (avail on CPAN) module useful.

Hope this helps.

--aj



More information about the Phoenix-pm mailing list