… | |
… | |
532 | close $pty; |
532 | close $pty; |
533 | |
533 | |
534 | # now communicate with rxvt |
534 | # now communicate with rxvt |
535 | my $slave = $pty->slave; |
535 | my $slave = $pty->slave; |
536 | while (<$slave>) { print $slave "got <$_>\n" } |
536 | while (<$slave>) { print $slave "got <$_>\n" } |
|
|
537 | |
|
|
538 | Note that, despite what the name might imply, the file descriptor does not |
|
|
539 | need to be a pty, it can be a bi-directional pipe as well (e.g. a unix |
|
|
540 | domain or tcp socket). While tty operations cannot be done in this case, |
|
|
541 | B<@@RXVT_NAME@@> can still be remote controlled with it: |
|
|
542 | |
|
|
543 | use Socket; |
|
|
544 | use Fcntl; |
|
|
545 | |
|
|
546 | socketpair my $URXVT, my $slave, Socket::AF_UNIX, Socket::SOCK_STREAM, Socket::PF_UNSPEC; |
|
|
547 | fcntl $slave, Fcntl::F_SETFD, 0; |
|
|
548 | system "exec @@RXVT_NAME|| -pty-fd " . (fileno $slave) . " &"; |
|
|
549 | close $slave; |
|
|
550 | |
|
|
551 | syswrite $URXVT, "Type a secret password: "; |
|
|
552 | my $secret = do { local $/ = "\r"; <$URXVT> }; |
|
|
553 | print "No so secret anymore: $secret\n"; |
537 | |
554 | |
538 | =item B<-pe> I<string> |
555 | =item B<-pe> I<string> |
539 | |
556 | |
540 | Comma-separated list of perl extension scripts to use (or not to use) in |
557 | Comma-separated list of perl extension scripts to use (or not to use) in |
541 | this terminal instance. See resource B<perl-ext> for details. |
558 | this terminal instance. See resource B<perl-ext> for details. |