I've been toying with the idea of trying to rig a web page to call an
expect script to login to our OPAC, look up a book and then display the
circ/renewal stats. The function would be accessible through a
mostly-invisible* link on our web page, and lead to a password-protected
script so that the output was only available to library staff. This
would let us look up circ stats from the web OPAC (which we can't do
through its native functionality), rather than having to log in to the
telnet/staff side to do so. The script takes about 20 seconds to
execute, so it would be pretty inefficient for large-scale lookup
operations, but would be really handy on those fairly frequent occasions
when you just want to know if a book that shows up in a search has ever
(* "mostly invisible" -- the link would be background-colored, so it
would show up for anyone using a text-browser on our web OPAC, and would
just get them to a password request if they followed it. Staff would
just have to know where to click the link on the page. I've tried that
approach for a previous experiment and it worked out reasonably well.)
1) does anyone have experience shunting Expect script output to web
pages? how did you get it to work? My initial attempts have not worked out:
- first try: using php's *echo exec ("script.exp")* or *passthru
("script.exp")* -- this returned my input, but didn't show the resulting
info screens output by the OPAC
- second try: calling the Expect script directly with a *puts
"Content-type: text/plain\n\n"* declaration at the beginning -- this
might work, but right now Apache is not configured to execute Expect
scripts for web output, so it just echoes the script contents instead of
executing the file. This could be altered, but not today.
2) Is this an inherently Bad Idea? I don't think it would be
particularly prone to abuse, and the user would not get to specify any
of the inputs for the script so I think it would be ok, but you may have
some ideas I'm overlooking.
3) Is there a much smarter way to do this?
What think you all?
expect "ingenious replies"
Thomas Library, Wittenberg University