Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Nov 95 17:27:16 EDT
From:      M C Wong <mcw@hpato.aus.hp.com>
To:        freebsd-questions@freefall.FreeBSD.org (freebsd-questions@freefall.cdrom.com)
Subject:   convert Expect's (spawn,send) into Perl equivalent ? Any guru out there?
Message-ID:  <199511150627.AA291436843@relay.hp.com>

next in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----

Hi,
    I have a need to convert an Expect script to Perl equivalent and one
of the things that I am stuck with is how one can achieve Expect's
spawn, send and interact with Perl ?

    Specifically, one of the procs in my Expect script spawns a shell process
and sends subsequent commands to that shell process. Also, at some point, I
need to use interfact such that the spawned process' STDIN and STDOUT get
`connected' back to the user's terminal, eg :


  if ( [ catch "spawn -noecho $shell_process" reason ] != 0 ) {
      puts "*** error: $reason"
      return 90
  }
  .
  .
  .
  send "<some_commands-0>\r";
  .
  .
  .
  # Note that I want the shell process to terminate after executing
  # <some_commands-N> in interactive mode, so I don't have to deal 
  # with scanning for shell-prompt symbol and send an "exit\r".
  send "<some_commands-N>; exit\r";
  interact
  .
  .
  .

  Does anyone have any suggestions ? Don't ask me why the conversion
needs to take place in the fist place please, 8-((((.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2i

iQCVAwUBMKmIPkmThh0X7Um5AQEDTQQAoXR20ZXBhsjoB4N+dN9EOn2CfZpDakyD
1BPyYqY+QFqN4yirCl6PbqEQ1vhnvKClp6ithsbk8j+TZ1+cHOsN3ZXiUIM+gEgw
xGIFIy3Ym66U9o3FZS5HVtRoaS/4v21a7Z9SdMyXUvuMyusb/Icqugd/ehzbwCYZ
rjVPbrYalLo=
=Cu0Q
-----END PGP SIGNATURE-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511150627.AA291436843>