Expert system doesn't initialize

风格不统一 提交于 2019-12-04 17:54:13
Dave Sherohman

(Originally submitted as an answer to the duplicate question at How can I find place of error in perl )

The error messages in the question state that the error is thrown at C:/Perl/lib/Term/ReadKey.pm line 362 and that use Term::ReadKey appears at C:/Perl/lib/Term/ReadLine/Perl.pm line 65. If you are running this code in a CGI environment, using ReadLine/ReadKey makes no sense and it's unsurprising that they fail to initialize.

However, you're creating your ExpertSystem instance with viewer_class => 'terminal', which causes it to use AI::ExpertSystem::Advanced::Viewer::Terminal, which "Extends from AI::ExpertSystem::Advanced::Viewer::Base and its main purpose is to interact with a (console) terminal" (emphasis mine) and it uses ReadLine to do so. In order to make this work, you need to use a different viewer class which does not "interact with a (console) terminal".

Unfortunately, a search of metacpan finds no other available viewers, so you'll need to either find one somewhere else (the author of AI::ExpertSystem::Advanced may know where you can get one for CGI) or write your own viewer class.

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