IO::Pty::HalfDuplexTreat interactive programs like subroutines | |
Download |
IO::Pty::HalfDuplex Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Publisher Name:
- Stefan O'Rear
- Publisher web site:
- http://search.cpan.org/~sorear/
IO::Pty::HalfDuplex Tags
IO::Pty::HalfDuplex Description
Treat interactive programs like subroutines IO::Pty::HalfDuplex is designed to perform impedence matching between driving programs which expect commands and responses, and driven programs which use a terminal in full-duplex mode. In this vein it is somewhat like expect, but less general and more robust (but see CAVEATS below).The IO::Pty::HalfDuplex module is used in object-oriented style. IO::Pty::HalfDuplex objects are connected to exactly one system pseudoterminal, which is allocated on creation; input and output are done using methods. The interface is deliberately kept similar to Jesse Luehrs' IO::Pty::Easy module; notable incompatibilities from the latter are: * The spawn() method reports failure to exec inline, on output followed by an exit. I see no reason why exec failures should be different from post-exec failures such as "dynamic library not found", and it considerably simplifes the code. * write() does not immediately write anything, but merely queues data to be released all at once by read(). It does not have a timeout parameter. * read() should generally not be passed a timeout, as it finds the end of output automatically. * The two-argument form of kill() interprets its second argument in the opposite sense.SYNOPSIS use IO::Pty::HalfDuplex; my $pty = IO::Pty::HalfDuplex->new; $pty->spawn("nethack"); $pty->read; # => "\nNetHack, copyright...for you? " $pty->write("nvd"); $pty->read; # => "... Velkommen sorear, you are a lawful dwarven Valkyrie.--More--" Requirements: · Perl
IO::Pty::HalfDuplex Related Software