NET::SSH::Expect configurations to work over windows

╄→гoц情女王★ 提交于 2019-12-24 00:24:53

问题


Machine details : Windows7 , 64-bits. I integrated perl in eclipse and used Net::SSH::Except module for scripting, but am getting an error as Can't locate Net/SSH/Expect.pm in @INC (you may need to install the Net::SSH::Expect module) (@INC contains: C:/Perl64/site/lib/MSWin32-x64-multi-thread C:/Perl64/site/lib C:/Perl64/lib .)

Therefore, Am trying to install IO::Tty for Expect dependency, using command cpan>notest install IO::Tty. i am getting the following error message : and the module is not being installed, even the NET::SSH::Expect not getting installed.

cpan> notest install IO::Tty
Reading 'C:\Perl64\cpan\Metadata'
Database was generated on Mon, 11 Dec 2017 04:41:02 GMT
Fetching with LWP:
http://ppm.activestate.com/CPAN/authors/01mailrc.txt.gz
Reading 'C:\Perl64\cpan\sources\authors\01mailrc.txt.gz'

.............................................................DONE

Fetching with LWP:
http://ppm.activestate.com/CPAN/modules/02packages.details.txt.gz
Reading 'C:\Perl64\cpan\sources\modules\02packages.details.txt.gz'
Database was generated on Tue, 12 Dec 2017 04:29:02 GMT
.............
**New CPAN.pm version (v2.16) available.
[Currently running version is v2.1101]
You might want to try
install CPAN
reload cpan
to both upgrade CPAN.pm and run the new version without leaving
the current session.**


..............................................................DONE
Fetching with LWP:
http://ppm.activestate.com/CPAN/modules/03modlist.data.gz
Reading 'C:\Perl64\cpan\sources\modules\03modlist.data.gz'
DONE
Writing C:\Perl64\cpan\Metadata
Running install for module 'IO::Tty'
Checksum for C:\Perl64\cpan\sources\authors\id\T\TO\TODDR\IO-Tty-1.12.tar.gz 
ok
Scanning cache C:\Perl64/cpan/build for sizes
...............................................................DONE

IO-Tty-1.12/
IO-Tty-1.12/ChangeLog
IO-Tty-1.12/Makefile.PL
IO-Tty-1.12/MANIFEST
IO-Tty-1.12/META.json
IO-Tty-1.12/META.yml
IO-Tty-1.12/Pty.pm
IO-Tty-1.12/README
IO-Tty-1.12/t/
IO-Tty-1.12/try
IO-Tty-1.12/Tty.pm
IO-Tty-1.12/Tty.xs
IO-Tty-1.12/t/test.t
Configuring T/TO/TODDR/IO-Tty-1.12.tar.gz with Makefile.PL
This module requires a POSIX compliant system to work. Try cygwin if you 
need this module on windows OS unsupported at Makefile.PL line 6.
Warning: No success on command[C:\Perl64\bin\perl.exe Makefile.PL 
INSTALLDIRS=site]
TODDR/IO-Tty-1.12.tar.gz
C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=site -- NOT OK
Failed during this command:
TODDR/IO-Tty-1.12.tar.gz                     : writemakefile NO 
'C:\Perl64\bin\
perl.exe Makefile.PL INSTALLDIRS=site' returned status 65280

i have tried installed IO::Tty with following command cpanm --install IO::Tty cpanm --verbose IO::Tty cpanm --force IO::Tty all failing , this may be due to the lower version of the perl. what is the command to upgrade cpan from cmd and also perl through cmd?


回答1:


Sadly the Perl Expect module requires a UNIX based OS to function. I have implemented this a few times on a windows platform and basically you need to install an older ActiveState distribution of TCL, then you can have the Perl script call an external EXPECT script, like this:

$expectOutput = `[path_to_expect_script.expect]`;

Your variable will then contain the output of the Expect script.

Hope this helps!

Edit: You may like to reword your title to attract more answers relating to using expect on windows.




回答2:


Solved!

  • the new version of Expect is made compatible with the windows, but it need to be installed with cygwin ..

  • In eclipse , make interpreter as cygwin (windows -> preference -> EPIC Perl -> interpreter).

and execute the script:)



来源:https://stackoverflow.com/questions/47790631/netsshexpect-configurations-to-work-over-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!