1Pty(3)                User Contributed Perl Documentation               Pty(3)
2
3
4

NAME

6       IO::Pty - Pseudo TTY object class
7

VERSION

9       1.08
10

SYNOPSIS

12           use IO::Pty;
13
14           $pty = new IO::Pty;
15
16           $slave  = $pty->slave;
17
18           foreach $val (1..10) {
19               print $pty "$val\n";
20               $_ = <$slave>;
21               print "$_";
22           }
23
24           close($slave);
25

DESCRIPTION

27       "IO::Pty" provides an interface to allow the creation of a pseudo tty.
28
29       "IO::Pty" inherits from "IO::Handle" and so provide all the methods
30       defined by the "IO::Handle" package.
31
32       Please note that pty creation is very system-dependend.  If you have
33       problems, see IO::Tty for help.
34

CONSTRUCTOR

36       new
37          The "new" constructor takes no arguments and returns a new file
38          object which is the master side of the pseudo tty.
39

METHODS

41       ttyname()
42           Returns the name of the slave pseudo tty. On UNIX machines this
43           will be the pathname of the device.  Use this name for
44           informational purpose only, to get a slave filehandle, use slave().
45
46       slave()
47           The "slave" method will return the slave filehandle of the given
48           master pty, opening it anew if necessary.  If IO::Stty is
49           installed, you can then call "$slave->stty()" to modify the
50           terminal settings.
51
52       close_slave()
53           The slave filehandle will be closed and destroyed.  This is
54           necessary in the parent after forking to get rid of the open
55           filehandle, otherwise the parent will not notice if the child
56           exits.  Subsequent calls of "slave()" will return a newly opened
57           slave filehandle.
58
59       make_slave_controlling_terminal()
60           This will set the slave filehandle as the controlling terminal of
61           the current process, which will become a session leader, so this
62           should only be called by a child process after a fork(), e.g. in
63           the callback to "sync_exec()" (see Proc::SyncExec).  See the "try"
64           script (also "test.pl") for an example how to correctly spawn a
65           subprocess.
66
67       set_raw()
68           Will set the pty to raw.  Note that this is a one-way operation,
69           you need IO::Stty to set the terminal settings to anything else.
70
71           On some systems, the master pty is not a tty.  This method checks
72           for that and returns success anyway on such systems.  Note that
73           this method must be called on the slave, and probably should be
74           called on the master, just to be sure, i.e.
75
76             $pty->slave->set_raw();
77             $pty->set_raw();
78
79       clone_winsize_from(\*FH)
80           Gets the terminal size from filehandle FH (which must be a
81           terminal) and transfers it to the pty.  Returns true on success and
82           undef on failure.  Note that this must be called upon the slave,
83           i.e.
84
85            $pty->slave->clone_winsize_from(\*STDIN);
86
87           On some systems, the master pty also isatty.  I actually have no
88           idea if setting terminal sizes there is passed through to the
89           slave, so if this method is called for a master that is not a tty,
90           it silently returns OK.
91
92           See the "try" script for example code how to propagate SIGWINCH.
93

SEE ALSO

95       IO::Tty, IO::Tty::Constant, IO::Handle, Expect, Proc::SyncExec
96

MAILING LISTS

98       As this module is mainly used by Expect, support for it is available
99       via the two Expect mailing lists, expectperl-announce and expectperl-
100       discuss, at
101
102         http://lists.sourceforge.net/lists/listinfo/expectperl-announce
103
104       and
105
106         http://lists.sourceforge.net/lists/listinfo/expectperl-discuss
107

AUTHORS

109       Originally by Graham Barr <gbarr@pobox.com>, based on the Ptty module
110       by Nick Ing-Simmons <nik@tiuk.ti.com>.
111
112       Now maintained and heavily rewritten by Roland Giersig
113       <RGiersig@cpan.org>.
114
115       Contains copyrighted stuff from openssh v3.0p1, authored by Tatu Ylonen
116       <ylo@cs.hut.fi>, Markus Friedl and Todd C. Miller
117       <Todd.Miller@courtesan.com>.
118
120       Now all code is free software; you can redistribute it and/or modify it
121       under the same terms as Perl itself.
122
123       Nevertheless the above AUTHORS retain their copyrights to the various
124       parts and want to receive credit if their source code is used.  See the
125       source for details.
126

DISCLAIMER

128       THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
129       WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
130       MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
131       IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
132       INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
133       BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
134       OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
135       ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
136       TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
137       USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
138       DAMAGE.
139
140       In other words: Use at your own risk.  Provided as is.  Your mileage
141       may vary.  Read the source, Luke!
142
143       And finally, just to be sure:
144
145       Any Use of This Product, in Any Manner Whatsoever, Will Increase the
146       Amount of Disorder in the Universe. Although No Liability Is Implied
147       Herein, the Consumer Is Warned That This Process Will Ultimately Lead
148       to the Heat Death of the Universe.
149
150
151
152perl v5.10.1                      2009-02-05                            Pty(3)
Impressum