Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Alternative to Expect for Activestate Perl on Windows ?

by fx (Pilgrim)
on Jan 15, 2008 at 19:17 UTC ( [id://662535] : perlquestion . print w/replies, xml ) Need Help??

fx has asked for the wisdom of the Perl Monks concerning the following question:

Thought this would be an easy one but perhaps I'm not sticking the right words into Google to find the answer.

I have an Activestate Perl installation under Windows Server 2003. I need to interactively control a command line question-answer type application with Perl. In (nice and comfortable) Unix world I'd just use the Expect module. Nice and easy. However, this does not work under AS Perl on Windows.

The CPAN page (here) says one alternative is to use Cygwin. I don't really have the option of installing this (I had to fight to even be allowed to install Perl....).

Any other suggestions?

In case it matters at all, the command line program I am trying to control is the "jbconfig" tape library configuration program that comes with EMC/Legato Networker.



Replies are listed 'Best First'.
Re: Alternative to Expect for Activestate Perl on Windows ?
by CountZero (Bishop) on Jan 15, 2008 at 22:09 UTC
    IO::React seems to provide similar functionality as Expect (disclaimer: I did not yet use either of them)


    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James


      The other alternatives I've seen put forth (basically, install ActiveTCL and use Expect) run afoul of what looks like a critical bureaucratic constraint: installing more scripting interpreters is a non-starter.

      I hope running PPM and installing ActiveState's instantiation of IO::React is permitted in your setting.

      FWIW, IO::React is "PASSED" across the board according to ActiveState, and is at the current CPAN rev (1.03). If you can do the PPM install and the module's capabilities are up to snuff, this may be the best answer.

        This is kinda intriguing, most programmers wouldn't argue that you should know more than one language and always use the best tool for the job. Plus Tcl is really, really simple and shouldn't be any pain to learn.

        But I guess, the good enough or even barely acceptable solution might win, since it's seems that using the best tool for the job might sometimes be too costly.
        So yea I too would vote for a Perl module, if you don't know Tcl and the module is good enough or even barely passable. (And that was an example of using if as a statment modifier)
Re: Alternative to Expect for Activestate Perl on Windows ?
by aquarium (Curate) on Jan 15, 2008 at 21:21 UTC
    Tcl ppm module is indicated as passed tests for windows, on the AS repository. Tcl has expect that you'd be able to use.
    the hardest line to type correctly is: stty erase ^H
Re: Alternative to Expect for Activestate Perl on Windows ?
by systems (Pilgrim) on Jan 16, 2008 at 06:09 UTC
Re: Alternative to Expect for Activestate Perl on Windows ?
by DrHyde (Prior) on Jan 21, 2008 at 10:23 UTC
    Strawberry Perl would probably be a good alternative to Activestate, but I suppose you'd have as much trouble installing that as you would Cygwin.

      Strawberry doesn't help because it still asks for IO::Tty. Cygwin should be a good try according to the Expect documentation.

      cpan> install IO::Tty Running install for module 'IO::Tty' Running make for T/TO/TODDR/IO-Tty-1.10.tar.gz Has already been unwrapped into directory C:\PERL\cpan\build\IO-Tty- +1.10-MfKyq R Could not make: Unknown error Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible cpan>