Sumit
Sumit

Reputation: 2023

Expect module not working in perl

I have installed expect module in perl at location C:\strawberry\perl\lib.

As a pre-requisite i have installed IO-Tty module first at same location were perl is installed.

Now if i am doing

use Expect;

It is throwing error

Can't locate IO/Pty.pm in @INC (@INC contains: C:/strawberry/perl/site/lib C:/st
rawberry/perl/vendor/lib C:/strawberry/perl/lib .) at C:/strawberry/perl/lib/Exp
ect.pm line 22.
BEGIN failed--compilation aborted at C:/strawberry/perl/lib/Expect.pm line 22.
Compilation failed in require at croak.txt line 1.
BEGIN failed--compilation aborted at croak.txt line 1.

Possible reasons are

  1. Perl is looking for IO::Pty and IO::Tty module which are called from Expect.pm. But When i have installed IO::Tty module, it is having 2 pm files with names Pty.pm and Tty.pm

    package Expect;
    
    use IO::Pty 0.97;       # We need make_slave_controlling_terminal()
    use IO::Tty;
    

But perl is looking for IO::Tty module.

Is this causing the issue. If yes then how can i move forward

Upvotes: 2

Views: 7373

Answers (2)

Slaven Rezic
Slaven Rezic

Reputation: 4581

Expect does not work under Windows.

At least this is my impression when looking at CPAN Resters results. This table here: http://matrix.cpantesters.org/?dist=Expect;maxver=1 shows that there was never a PASS for Expect under Windows.

Also, the Expect documentation talks about the module not working with ActivePerl and recommends to use cygwin instead: https://metacpan.org/module/RGIERSIG/Expect-1.21/Expect.pod#Can-I-use-this-module-with-ActivePerl-on-Windows. I assume that Expect does not work with StrawberryPerl, too.

Upvotes: 3

Christoph
Christoph

Reputation: 315

Did you installed these modules using cpan? - I would highly recommend to install modules only via cpan, so you'll get all the dependencies needed.

If you've done so, try to reinstall it and watch out for any errors.

I tested the install via cpan and it needs to compile the IO::Tty package, so maybe you need to set-up an build environment for any perl modules you would like to install.

If you just copied some precompiled files verify that the files you're missing really exist and download the package again.

Edit: What I missed - The full path for your Pty.pm and Tty.pm should be something like "C:/strawberry/perl/lib/IO/Tty.pm"

Upvotes: 1

Related Questions