D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
vblioqus
/
karachi777.vip
/
in
/
106014
/
900508
/
Filename :
perl5.zip
back
Copy
PK vk\39�! ! IO/Tty.pmnu �7��m # Documentation at the __END__ # -*-cperl-*- package IO::Tty; use strict; use warnings; use IO::Handle; use IO::File; use IO::Tty::Constant; use Carp; require POSIX; require DynaLoader; use vars qw(@ISA $VERSION $XS_VERSION $CONFIG $DEBUG); $VERSION = '1.20'; $XS_VERSION = "1.20"; @ISA = qw(IO::Handle); eval { local $^W = 0; undef local $SIG{__DIE__}; require IO::Stty }; push @ISA, "IO::Stty" if ( not $@ ); # if IO::Stty is installed BOOT_XS: { # If I inherit DynaLoader then I inherit AutoLoader and I DON'T WANT TO require DynaLoader; # DynaLoader calls dl_load_flags as a static method. *dl_load_flags = DynaLoader->can('dl_load_flags'); do { defined(&bootstrap) ? \&bootstrap : \&DynaLoader::bootstrap; } ->(__PACKAGE__); } sub import { IO::Tty::Constant->export_to_level( 1, @_ ); } sub open { my ( $tty, $dev, $mode ) = @_; IO::File::open( $tty, $dev, $mode ) or return undef; $tty->autoflush; 1; } sub clone_winsize_from { my ( $self, $fh ) = @_; croak "Given filehandle is not a tty in clone_winsize_from, called" if not POSIX::isatty($fh); return 1 if not POSIX::isatty($self); # ignored for master ptys my $winsize = " " x 1024; # preallocate memory for older perl versions $winsize = ''; # But leave the SV as empty ioctl( $fh, &IO::Tty::Constant::TIOCGWINSZ, $winsize ) and ioctl( $self, &IO::Tty::Constant::TIOCSWINSZ, $winsize ) and return 1; warn "clone_winsize_from: error: $!" if $^W; return undef; } # ioctl() doesn't tell us how long the structure is, so we'll have to trim it # after TIOCGWINSZ my $SIZEOF_WINSIZE = length IO::Tty::pack_winsize( 0, 0, 0, 0 ); sub get_winsize { my $self = shift; my $winsize = " " x 1024; # preallocate memory ioctl( $self, IO::Tty::Constant::TIOCGWINSZ(), $winsize ) or croak "Cannot TIOCGWINSZ - $!"; substr( $winsize, $SIZEOF_WINSIZE ) = ""; return IO::Tty::unpack_winsize($winsize); } sub set_winsize { my $self = shift; my $winsize = IO::Tty::pack_winsize(@_); ioctl( $self, IO::Tty::Constant::TIOCSWINSZ(), $winsize ) or croak "Cannot TIOCSWINSZ - $!"; } sub set_raw($) { require POSIX; my $self = shift; return 1 if not POSIX::isatty($self); my $ttyno = fileno($self); my $termios = new POSIX::Termios; unless ($termios) { warn "set_raw: new POSIX::Termios failed: $!"; return undef; } unless ( $termios->getattr($ttyno) ) { warn "set_raw: getattr($ttyno) failed: $!"; return undef; } $termios->setiflag(0); $termios->setoflag(0); $termios->setlflag(0); $termios->setcc( &POSIX::VMIN, 1 ); $termios->setcc( &POSIX::VTIME, 0 ); unless ( $termios->setattr( $ttyno, &POSIX::TCSANOW ) ) { warn "set_raw: setattr($ttyno) failed: $!"; return undef; } return 1; } 1; __END__ =head1 NAME IO::Tty - Low-level allocate a pseudo-Tty, import constants. =head1 VERSION 1.20 =head1 SYNOPSIS use IO::Tty qw(TIOCNOTTY); ... # use only to import constants, see IO::Pty to create ptys. =head1 DESCRIPTION C<IO::Tty> is used internally by C<IO::Pty> to create a pseudo-tty. You wouldn't want to use it directly except to import constants, use C<IO::Pty>. For a list of importable constants, see L<IO::Tty::Constant>. Windows is now supported, but ONLY under the Cygwin environment, see L<http://sources.redhat.com/cygwin/>. Please note that pty creation is very system-dependend. From my experience, any modern POSIX system should be fine. Find below a list of systems that C<IO::Tty> should work on. A more detailed table (which is slowly getting out-of-date) is available from the project pages document manager at SourceForge L<http://sourceforge.net/projects/expectperl/>. If you have problems on your system and your system is listed in the "verified" list, you probably have some non-standard setup, e.g. you compiled your Linux-kernel yourself and disabled ptys (bummer!). Please ask your friendly sysadmin for help. If your system is not listed, unpack the latest version of C<IO::Tty>, do a C<'perl Makefile.PL; make; make test; uname -a'> and send me (F<RGiersig@cpan.org>) the results and I'll see what I can deduce from that. There are chances that it will work right out-of-the-box... If it's working on your system, please send me a short note with details (version number, distribution, etc. 'uname -a' and 'perl -V' is a good start; also, the output from "perl Makefile.PL" contains a lot of interesting info, so please include that as well) so I can get an overview. Thanks! =head1 VERIFIED SYSTEMS, KNOWN ISSUES This is a list of systems that C<IO::Tty> seems to work on ('make test' passes) with comments about "features": =over 4 =item * AIX 4.3 Returns EIO instead of EOF when the slave is closed. Benign. =item * AIX 5.x =item * FreeBSD 4.4 EOF on the slave tty is not reported back to the master. =item * OpenBSD 2.8 The ioctl TIOCSCTTY sometimes fails. This is also known in Tcl/Expect, see http://expect.nist.gov/FAQ.html EOF on the slave tty is not reported back to the master. =item * Darwin 7.9.0 =item * HPUX 10.20 & 11.00 EOF on the slave tty is not reported back to the master. =item * IRIX 6.5 =item * Linux 2.2.x & 2.4.x Returns EIO instead of EOF when the slave is closed. Benign. =item * OSF 4.0 EOF on the slave tty is not reported back to the master. =item * Solaris 8, 2.7, 2.6 Has the "feature" of returning EOF just once?! EOF on the slave tty is not reported back to the master. =item * Windows NT/2k/XP (under Cygwin) When you send (print) a too long line (>160 chars) to a non-raw pty, the call just hangs forever and even alarm() cannot get you out. Don't complain to me... EOF on the slave tty is not reported back to the master. =item * z/OS =back The following systems have not been verified yet for this version, but a previous version worked on them: =over 4 =item * SCO Unix =item * NetBSD probably the same as the other *BSDs... =back If you have additions to these lists, please mail them to E<lt>F<RGiersig@cpan.org>E<gt>. =head1 SEE ALSO L<IO::Pty>, L<IO::Tty::Constant> =head1 MAILING LISTS As this module is mainly used by Expect, support for it is available via the two Expect mailing lists, expectperl-announce and expectperl-discuss, at http://lists.sourceforge.net/lists/listinfo/expectperl-announce and http://lists.sourceforge.net/lists/listinfo/expectperl-discuss =head1 AUTHORS Originally by Graham Barr E<lt>F<gbarr@pobox.com>E<gt>, based on the Ptty module by Nick Ing-Simmons E<lt>F<nik@tiuk.ti.com>E<gt>. Now maintained and heavily rewritten by Roland Giersig E<lt>F<RGiersig@cpan.org>E<gt>. Contains copyrighted stuff from openssh v3.0p1, authored by Tatu Ylonen <ylo@cs.hut.fi>, Markus Friedl and Todd C. Miller <Todd.Miller@courtesan.com>. I also got a lot of inspiration from the pty code in Xemacs. =head1 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 their source code is used. See the source for details. =head1 DISCLAIMER THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 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 Any Manner Whatsoever, Will Increase the Amount of Disorder in 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. =cut PK vk\;�ʧ8 8 IO/Tty/Constant.pmnu ��6�$ package IO::Tty::Constant; our $VERSION = '1.20'; use vars qw(@ISA @EXPORT_OK); require Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw(B0 B110 B115200 B1200 B134 B150 B153600 B1800 B19200 B200 B230400 B2400 B300 B307200 B38400 B460800 B4800 B50 B57600 B600 B75 B76800 B9600 BRKINT BS0 BS1 BSDLY CBAUD CBAUDEXT CBRK CCTS_OFLOW CDEL CDSUSP CEOF CEOL CEOL2 CEOT CERASE CESC CFLUSH CIBAUD CIBAUDEXT CINTR CKILL CLNEXT CLOCAL CNSWTCH CNUL CQUIT CR0 CR1 CR2 CR3 CRDLY CREAD CRPRNT CRTSCTS CRTSXOFF CRTS_IFLOW CS5 CS6 CS7 CS8 CSIZE CSTART CSTOP CSTOPB CSUSP CSWTCH CWERASE DEFECHO DIOC DIOCGETP DIOCSETP DOSMODE ECHO ECHOCTL ECHOE ECHOK ECHOKE ECHONL ECHOPRT EXTA EXTB FF0 FF1 FFDLY FIORDCHK FLUSHO HUPCL ICANON ICRNL IEXTEN IGNBRK IGNCR IGNPAR IMAXBEL INLCR INPCK ISIG ISTRIP IUCLC IXANY IXOFF IXON KBENABLED LDCHG LDCLOSE LDDMAP LDEMAP LDGETT LDGMAP LDIOC LDNMAP LDOPEN LDSETT LDSMAP LOBLK NCCS NL0 NL1 NLDLY NOFLSH OCRNL OFDEL OFILL OLCUC ONLCR ONLRET ONOCR OPOST PAGEOUT PARENB PAREXT PARMRK PARODD PENDIN RCV1EN RTS_TOG TAB0 TAB1 TAB2 TAB3 TABDLY TCDSET TCFLSH TCGETA TCGETS TCIFLUSH TCIOFF TCIOFLUSH TCION TCOFLUSH TCOOFF TCOON TCSADRAIN TCSAFLUSH TCSANOW TCSBRK TCSETA TCSETAF TCSETAW TCSETCTTY TCSETS TCSETSF TCSETSW TCXONC TERM_D40 TERM_D42 TERM_H45 TERM_NONE TERM_TEC TERM_TEX TERM_V10 TERM_V61 TIOCCBRK TIOCCDTR TIOCCONS TIOCEXCL TIOCFLUSH TIOCGETD TIOCGETC TIOCGETP TIOCGLTC TIOCSETC TIOCSETN TIOCSETP TIOCSLTC TIOCGPGRP TIOCGSID TIOCGSOFTCAR TIOCGWINSZ TIOCHPCL TIOCKBOF TIOCKBON TIOCLBIC TIOCLBIS TIOCLGET TIOCLSET TIOCMBIC TIOCMBIS TIOCMGET TIOCMSET TIOCM_CAR TIOCM_CD TIOCM_CTS TIOCM_DSR TIOCM_DTR TIOCM_LE TIOCM_RI TIOCM_RNG TIOCM_RTS TIOCM_SR TIOCM_ST TIOCNOTTY TIOCNXCL TIOCOUTQ TIOCREMOTE TIOCSBRK TIOCSCTTY TIOCSDTR TIOCSETD TIOCSIGNAL TIOCSPGRP TIOCSSID TIOCSSOFTCAR TIOCSTART TIOCSTI TIOCSTOP TIOCSWINSZ TM_ANL TM_CECHO TM_CINVIS TM_LCF TM_NONE TM_SET TM_SNL TOSTOP VCEOF VCEOL VDISCARD VDSUSP VEOF VEOL VEOL2 VERASE VINTR VKILL VLNEXT VMIN VQUIT VREPRINT VSTART VSTOP VSUSP VSWTCH VT0 VT1 VTDLY VTIME VWERASE WRAP XCASE XCLUDE XMT1EN XTABS); __END__ =head1 NAME IO::Tty::Constant - Terminal Constants (autogenerated) =head1 SYNOPSIS use IO::Tty::Constant qw(TIOCNOTTY); ... =head1 DESCRIPTION This package defines constants usually found in <termio.h> or <termios.h> (and their #include hierarchy). Find below an autogenerated alphabetic list of all known constants and whether they are defined on your system (prefixed with '+') and have compilation problems ('o'). Undefined or problematic constants are set to 'undef'. =head1 DEFINED CONSTANTS =over 4 =item + B0 =item + B110 =item + B115200 =item + B1200 =item + B134 =item + B150 =item - B153600 =item + B1800 =item + B19200 =item + B200 =item + B230400 =item + B2400 =item + B300 =item - B307200 =item + B38400 =item + B460800 =item + B4800 =item + B50 =item + B57600 =item + B600 =item + B75 =item - B76800 =item + B9600 =item + BRKINT =item + BS0 =item + BS1 =item + BSDLY =item + CBAUD =item - CBAUDEXT =item + CBRK =item - CCTS_OFLOW =item - CDEL =item + CDSUSP =item + CEOF =item + CEOL =item - CEOL2 =item + CEOT =item + CERASE =item - CESC =item + CFLUSH =item + CIBAUD =item - CIBAUDEXT =item + CINTR =item + CKILL =item + CLNEXT =item + CLOCAL =item - CNSWTCH =item - CNUL =item + CQUIT =item + CR0 =item + CR1 =item + CR2 =item + CR3 =item + CRDLY =item + CREAD =item + CRPRNT =item + CRTSCTS =item - CRTSXOFF =item - CRTS_IFLOW =item + CS5 =item + CS6 =item + CS7 =item + CS8 =item + CSIZE =item + CSTART =item + CSTOP =item + CSTOPB =item + CSUSP =item - CSWTCH =item + CWERASE =item - DEFECHO =item - DIOC =item - DIOCGETP =item - DIOCSETP =item - DOSMODE =item + ECHO =item + ECHOCTL =item + ECHOE =item + ECHOK =item + ECHOKE =item + ECHONL =item + ECHOPRT =item + EXTA =item + EXTB =item + FF0 =item + FF1 =item + FFDLY =item - FIORDCHK =item + FLUSHO =item + HUPCL =item + ICANON =item + ICRNL =item + IEXTEN =item + IGNBRK =item + IGNCR =item + IGNPAR =item + IMAXBEL =item + INLCR =item + INPCK =item + ISIG =item + ISTRIP =item + IUCLC =item + IXANY =item + IXOFF =item + IXON =item - KBENABLED =item - LDCHG =item - LDCLOSE =item - LDDMAP =item - LDEMAP =item - LDGETT =item - LDGMAP =item - LDIOC =item - LDNMAP =item - LDOPEN =item - LDSETT =item - LDSMAP =item - LOBLK =item + NCCS =item + NL0 =item + NL1 =item + NLDLY =item + NOFLSH =item + OCRNL =item + OFDEL =item + OFILL =item + OLCUC =item + ONLCR =item + ONLRET =item + ONOCR =item + OPOST =item - PAGEOUT =item + PARENB =item - PAREXT =item + PARMRK =item + PARODD =item + PENDIN =item - RCV1EN =item - RTS_TOG =item + TAB0 =item + TAB1 =item + TAB2 =item + TAB3 =item + TABDLY =item - TCDSET =item + TCFLSH =item + TCGETA =item + TCGETS =item + TCIFLUSH =item + TCIOFF =item + TCIOFLUSH =item + TCION =item + TCOFLUSH =item + TCOOFF =item + TCOON =item + TCSADRAIN =item + TCSAFLUSH =item + TCSANOW =item + TCSBRK =item + TCSETA =item + TCSETAF =item + TCSETAW =item - TCSETCTTY =item + TCSETS =item + TCSETSF =item + TCSETSW =item + TCXONC =item - TERM_D40 =item - TERM_D42 =item - TERM_H45 =item - TERM_NONE =item - TERM_TEC =item - TERM_TEX =item - TERM_V10 =item - TERM_V61 =item + TIOCCBRK =item - TIOCCDTR =item + TIOCCONS =item + TIOCEXCL =item - TIOCFLUSH =item + TIOCGETD =item - TIOCGETC =item - TIOCGETP =item - TIOCGLTC =item - TIOCSETC =item - TIOCSETN =item - TIOCSETP =item - TIOCSLTC =item + TIOCGPGRP =item + TIOCGSID =item + TIOCGSOFTCAR =item + TIOCGWINSZ =item - TIOCHPCL =item - TIOCKBOF =item - TIOCKBON =item - TIOCLBIC =item - TIOCLBIS =item - TIOCLGET =item - TIOCLSET =item + TIOCMBIC =item + TIOCMBIS =item + TIOCMGET =item + TIOCMSET =item + TIOCM_CAR =item + TIOCM_CD =item + TIOCM_CTS =item + TIOCM_DSR =item + TIOCM_DTR =item + TIOCM_LE =item + TIOCM_RI =item + TIOCM_RNG =item + TIOCM_RTS =item + TIOCM_SR =item + TIOCM_ST =item + TIOCNOTTY =item + TIOCNXCL =item + TIOCOUTQ =item - TIOCREMOTE =item + TIOCSBRK =item + TIOCSCTTY =item - TIOCSDTR =item + TIOCSETD =item - TIOCSIGNAL =item + TIOCSPGRP =item - TIOCSSID =item + TIOCSSOFTCAR =item - TIOCSTART =item + TIOCSTI =item - TIOCSTOP =item + TIOCSWINSZ =item - TM_ANL =item - TM_CECHO =item - TM_CINVIS =item - TM_LCF =item - TM_NONE =item - TM_SET =item - TM_SNL =item + TOSTOP =item - VCEOF =item - VCEOL =item + VDISCARD =item - VDSUSP =item + VEOF =item + VEOL =item + VEOL2 =item + VERASE =item + VINTR =item + VKILL =item + VLNEXT =item + VMIN =item + VQUIT =item + VREPRINT =item + VSTART =item + VSTOP =item + VSUSP =item - VSWTCH =item + VT0 =item + VT1 =item + VTDLY =item + VTIME =item + VWERASE =item - WRAP =item + XCASE =item - XCLUDE =item - XMT1EN =item + XTABS =back =head1 FOR MORE INFO SEE L<IO::Tty> =cut PK vk\ !�D�$ �$ IO/Pty.pmnu ��6�$ # Documentation at the __END__ package IO::Pty; use strict; use Carp; use IO::Tty qw(TIOCSCTTY TCSETCTTY TIOCNOTTY); use IO::File; require POSIX; use vars qw(@ISA $VERSION); $VERSION = '1.20'; # keep same as in Tty.pm @ISA = qw(IO::Handle); eval { local $^W = 0; undef local $SIG{__DIE__}; require IO::Stty }; push @ISA, "IO::Stty" if ( not $@ ); # if IO::Stty is installed sub new { my ($class) = $_[0] || "IO::Pty"; $class = ref($class) if ref($class); @_ <= 1 or croak 'usage: new $class'; my ( $ptyfd, $ttyfd, $ttyname ) = pty_allocate(); croak "Cannot open a pty" if not defined $ptyfd; my $pty = $class->SUPER::new_from_fd( $ptyfd, "r+" ); croak "Cannot create a new $class from fd $ptyfd: $!" if not $pty; $pty->autoflush(1); bless $pty => $class; my $slave = IO::Tty->new_from_fd( $ttyfd, "r+" ); croak "Cannot create a new IO::Tty from fd $ttyfd: $!" if not $slave; $slave->autoflush(1); ${*$pty}{'io_pty_slave'} = $slave; ${*$pty}{'io_pty_ttyname'} = $ttyname; ${*$slave}{'io_tty_ttyname'} = $ttyname; return $pty; } sub ttyname { @_ == 1 or croak 'usage: $pty->ttyname();'; my $pty = shift; ${*$pty}{'io_pty_ttyname'}; } sub close_slave { @_ == 1 or croak 'usage: $pty->close_slave();'; my $master = shift; if ( exists ${*$master}{'io_pty_slave'} ) { close ${*$master}{'io_pty_slave'}; delete ${*$master}{'io_pty_slave'}; } } sub slave { @_ == 1 or croak 'usage: $pty->slave();'; my $master = shift; if ( exists ${*$master}{'io_pty_slave'} ) { return ${*$master}{'io_pty_slave'}; } my $tty = ${*$master}{'io_pty_ttyname'}; my $slave = new IO::Tty; $slave->open( $tty, O_RDWR | O_NOCTTY ) || croak "Cannot open slave $tty: $!"; return $slave; } sub make_slave_controlling_terminal { @_ == 1 or croak 'usage: $pty->make_slave_controlling_terminal();'; my $self = shift; local (*DEVTTY); # loose controlling terminal explicitly if ( defined TIOCNOTTY ) { if ( open( \*DEVTTY, "/dev/tty" ) ) { ioctl( \*DEVTTY, TIOCNOTTY, 0 ); close \*DEVTTY; } } # Create a new 'session', lose controlling terminal. if ( POSIX::setsid() == -1 ) { warn "setsid() failed, strange behavior may result: $!\r\n" if $^W; } if ( open( \*DEVTTY, "/dev/tty" ) ) { warn "Could not disconnect from controlling terminal?!\n" if $^W; close \*DEVTTY; } # now open slave, this should set it as controlling tty on some systems my $ttyname = ${*$self}{'io_pty_ttyname'}; my $slv = new IO::Tty; $slv->open( $ttyname, O_RDWR ) or croak "Cannot open slave $ttyname: $!"; if ( not exists ${*$self}{'io_pty_slave'} ) { ${*$self}{'io_pty_slave'} = $slv; } else { $slv->close; } # Acquire a controlling terminal if this doesn't happen automatically if ( not open( \*DEVTTY, "/dev/tty" ) ) { if ( defined TIOCSCTTY ) { if ( not defined ioctl( ${*$self}{'io_pty_slave'}, TIOCSCTTY, 0 ) ) { warn "warning: TIOCSCTTY failed, slave might not be set as controlling terminal: $!" if $^W; } } elsif ( defined TCSETCTTY ) { if ( not defined ioctl( ${*$self}{'io_pty_slave'}, TCSETCTTY, 0 ) ) { warn "warning: TCSETCTTY failed, slave might not be set as controlling terminal: $!" if $^W; } } else { warn "warning: You have neither TIOCSCTTY nor TCSETCTTY on your system\n" if $^W; return 0; } } if ( not open( \*DEVTTY, "/dev/tty" ) ) { warn "Error: could not connect pty as controlling terminal!\n"; return undef; } else { close \*DEVTTY; } return 1; } *clone_winsize_from = \&IO::Tty::clone_winsize_from; *get_winsize = \&IO::Tty::get_winsize; *set_winsize = \&IO::Tty::set_winsize; *set_raw = \&IO::Tty::set_raw; 1; __END__ =head1 NAME IO::Pty - Pseudo TTY object class =head1 VERSION 1.20 =head1 SYNOPSIS use IO::Pty; $pty = new IO::Pty; $slave = $pty->slave; foreach $val (1..10) { print $pty "$val\n"; $_ = <$slave>; print "$_"; } close($slave); =head1 DESCRIPTION C<IO::Pty> provides an interface to allow the creation of a pseudo tty. C<IO::Pty> inherits from C<IO::Handle> and so provide all the methods defined by the C<IO::Handle> package. Please note that pty creation is very system-dependent. If you have problems, see L<IO::Tty> for help. =head1 CONSTRUCTOR =over 3 =item new The C<new> constructor takes no arguments and returns a new file object which is the master side of the pseudo tty. =back =head1 METHODS =over 4 =item ttyname() Returns the name of the slave pseudo tty. On UNIX machines this will be the pathname of the device. Use this name for informational purpose only, to get a slave filehandle, use slave(). =item slave() The C<slave> method will return the slave filehandle of the given master pty, opening it anew if necessary. If IO::Stty is installed, you can then call C<$slave-E<gt>stty()> to modify the terminal settings. =item close_slave() The slave filehandle will be closed and destroyed. This is necessary in the parent after forking to get rid of the open filehandle, otherwise the parent will not notice if the child exits. Subsequent calls of C<slave()> will return a newly opened slave filehandle. =item make_slave_controlling_terminal() This will set 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 the callback to C<sync_exec()> (see L<Proc::SyncExec>). See the C<try> script (also C<test.pl>) for an example how to correctly spawn a subprocess. =item set_raw() Will set the pty to raw. Note that this is a one-way operation, you need IO::Stty to set the terminal settings to anything else. On some systems, the master 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, just to be sure, i.e. $pty->slave->set_raw(); $pty->set_raw(); =item clone_winsize_from(\*FH) Gets the terminal size from filehandle FH (which must be a terminal) and transfers it to the pty. Returns true on success and undef on failure. Note that this must be called upon the I<slave>, i.e. $pty->slave->clone_winsize_from(\*STDIN); On some systems, the master pty also isatty. I actually have no idea if setting terminal sizes there is passed through to the slave, so if this method is called for a master that is not a tty, it silently returns OK. See the C<try> script for example code how to propagate SIGWINCH. =item get_winsize() Returns the terminal size, in a 4-element list. ($row, $col, $xpixel, $ypixel) = $tty->get_winsize() =item set_winsize($row, $col, $xpixel, $ypixel) Sets the terminal size. If not specified, C<$xpixel> and C<$ypixel> are set to 0. As with C<clone_winsize_from>, this must be called upon the I<slave>. =back =head1 SEE ALSO L<IO::Tty>, L<IO::Tty::Constant>, L<IO::Handle>, L<Expect>, L<Proc::SyncExec> =head1 MAILING LISTS As this module is mainly used by Expect, support for it is available via the two Expect mailing lists, expectperl-announce and expectperl-discuss, at http://lists.sourceforge.net/lists/listinfo/expectperl-announce and http://lists.sourceforge.net/lists/listinfo/expectperl-discuss =head1 AUTHORS Originally by Graham Barr E<lt>F<gbarr@pobox.com>E<gt>, based on the Ptty module by Nick Ing-Simmons E<lt>F<nik@tiuk.ti.com>E<gt>. Now maintained and heavily rewritten by Roland Giersig E<lt>F<RGiersig@cpan.org>E<gt>. Contains copyrighted stuff from openssh v3.0p1, authored by Tatu Ylonen <ylo@cs.hut.fi>, Markus Friedl and Todd C. Miller <Todd.Miller@courtesan.com>. =head1 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 their source code is used. See the source for details. =head1 DISCLAIMER THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 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 Any Manner Whatsoever, Will Increase the Amount of Disorder in 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. =cut PK vk\$߅|h&