Seth Woolley's Man Viewer

IO::Pty(3) - IO::Pty - Pseudo TTY object class - man 3 IO::Pty

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

Pty(3)                User Contributed Perl Documentation               Pty(3)



NAME
       IO::Pty - Pseudo TTY object class

VERSION
       1.02

SYNOPSIS
           use IO::Pty;

           $pty = new IO::Pty;

           $slave  = $pty->slave;

           foreach $val (1..10) {
               print $pty "$val\n";
               $_ = <$slave>;
               print "$_";
           }

           close(2,7,n)($slave);

DESCRIPTION
       "IO::Pty" provides an interface to allow the creation of a pseudo tty.

       "IO::Pty" inherits from "IO::Handle" and so provide all the methods
       defined by the "IO::Handle" package.

       Please note that pty creation is very system-dependend.  If you have
       problems, see IO::Tty for help.

CONSTRUCTOR
       new
          The "new" constructor takes no arguments and returns a new file(1,n)
          object which is the master(5,8) side of the pseudo tty.

METHODS
       ttyname()
           Returns the name of the slave pseudo tty. On UNIX machines this
           will be the pathname of the device.  Use this name for informa-
           tional purpose only, to get a slave filehandle, use slave().

       slave()
           The "slave" method will return the slave filehandle of the given
           master(5,8) pty, opening it anew if(3,n) necessary.  If IO::Stty is
           installed, you can then call "$slave->stty()" to modify the termi-
           nal settings.

       close_slave()
           The slave filehandle will be closed and destroyed.  This is neces-
           sary in(1,8) the parent after forking to get rid of the open(2,3,n) filehandle,
           otherwise the parent will not notice if(3,n) the child exits.  Subse-
           quent calls of "slave()" will return a newly opened slave filehan-
           dle.

       make_slave_controlling_terminal()
           This will set(7,n,1 builtins) the slave filehandle as the controlling terminal of
           the current process, which will become a session leader, so this
           should only be called by a child process after a fork(), e.g. in(1,8)
           the callback to "sync_exec()" (see Proc::SyncExec).  See the "try"
           script (also "test.pl") for an example how to correctly spawn a
           subprocess.

       set_raw()
           Will set(7,n,1 builtins) the pty to raw.  Note that this is a one-way operation,
           you need IO::Stty to set(7,n,1 builtins) the terminal settings to anything else.

           On some systems, the master(5,8) pty is not a tty.  This method checks
           for that and returns success anyway on such systems.  Note that
           this method must be called on the slave, and probably should be
           called on the master(5,8), just to be sure, i.e.

             $pty->slave->set_raw();
             $pty->set_raw();

       clone_winsize_from(\*FH)
           Gets the terminal size from filehandle FH (which must be a termi-
           nal) and transfers it to the pty.  Returns true on success and
           undef on failure.  Note that this must be called upon the slave,
           i.e.

            $pty->slave->clone_winsize_from(\*STDIN);

           On some systems, the master(5,8) pty also isatty.  I actually have no
           idea if(3,n) setting terminal sizes there is passed through to the
           slave, so if(3,n) this method is called for a master(5,8) that is not a tty(1,4),
           it silently returns OK.

           See the "try" script for example code how to propagate SIGWINCH.

SEE ALSO
       IO::Tty, IO::Tty::Constant, IO::Handle, Expect, Proc::SyncExec

MAILING LISTS
       As this module is mainly used by Expect, support for it is available
       via the two Expect mailing lists, expectperl-announce and expect-
       perl-discuss, at

         http://lists.sourceforge.net/lists/listinfo/expectperl-announce

       and

         http://lists.sourceforge.net/lists/listinfo/expectperl-discuss

AUTHORS
       Originally by Graham Barr <gbarr@pobox.com>, based on the Ptty module
       by Nick Ing-Simmons <nik@tiuk.ti.com>.

       Now maintained and heavily rewritten by Roland Giersig <RGier-
       sig@cpan.org>.

       Contains copyrighted stuff from openssh v3.0p1, authored by Tatu Ylonen
       <ylo@cs.hut.fi>, Markus Friedl and Todd C. Miller <Todd.Miller@courte-
       san.com>.

COPYRIGHT
       Now all code is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.

       Nevertheless the above AUTHORS retain their copyrights to the various
       parts and want to receive credit if(3,n) their source code is used.  See the
       source for details.

DISCLAIMER
       THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WAR-
       RANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
       CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
       NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDEN-
       TAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
       LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
       DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
       THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
       OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

       In other words: Use at your own risk.  Provided as is.  Your mileage
       may vary.  Read the source, Luke!

       And finally, just to be sure:

       Any Use of This Product, in(1,8) Any Manner Whatsoever, Will Increase the
       Amount of Disorder in(1,8) the Universe. Although No Liability Is Implied
       Herein, the Consumer Is Warned That This Process Will Ultimately Lead
       to the Heat Death of the Universe.



perl v5.8.5                       2004-10-30                            Pty(3)

References for this manual (incoming links)