Can Expect be run as a CGI script?
Expect FAQ (Frequently Asked Questions)Many Expect scripts can be run directly with one change – the following line should be inserted before any other output: puts “Content-type: text/html\n” Next, make sure you invoke external programs using full paths. For example, instead of “spawn telnet”, use “spawn /usr/ucb/telnet” (or whatever). Remember that the PATH and other environment variables are going to be different than what you are used to.