(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.