In an older blog post I mentioned getting Alicebot Program V, a Perl implementation of an Alice AIML bot, up and running on a modern version of Perl, but I didn't go into any details on what I actually did to get this to work (which wasn't very nice of me ;) ).
Unfortunately for me I also didn't even write down any notes for myself, so I had to figure it out again, myself, from scratch. Which I decided to do, only this time I wrote down some notes, and published a new, updated version of Program V which you can check out on GitHub -- or for the lazy, get a zipped release of Program V 0.09.
This blog post is about what I needed to do to get Program V up and running, some of which is also outlined in UpdateNotes.md
on the GitHub repo.
So, first of all, Program V was programmed for Perl version 5.6, which is ancient; by the time I had discovered the existence of Program V, the current version of Perl was 5.8, and already, Program V would not run out-of-the-box on Perl 5.8; and I was a newbie back then and had no experience to draw from to figure out how to get Program V to work for me. I wanted to use Perl to make chatbots, and Program V was the only AIML implementation around, but I couldn't use it, and it eventually led me to just create my own chatbot language to replace AIML for me -- RiveScript.
The differences between Perl 5.6 and all newer versions are pretty significant and some things have changed, and that's the basic background on why Program V was hard to get to work.
So the first thing I needed was to install the Perl modules Unicode::String
and Unicode::Map8
- I learned this the hard way by trying to run build.pl
and getting missing module errors, but the README also mentioned I needed these things. And then I got an error message that probably looks familiar to a lot of people who've tried (and failed) with Program V:
[~/g/programv]$ perl build.pl
Constant subroutine AIML::Common::LOCK_SH redefined at lib/AIML/Common.pm line 52.
Prototype mismatch: sub AIML::Common::LOCK_SH () vs none at lib/AIML/Common.pm line 52.
Constant subroutine AIML::Common::LOCK_EX redefined at lib/AIML/Common.pm line 53.
Prototype mismatch: sub AIML::Common::LOCK_EX () vs none at lib/AIML/Common.pm line 53.
Constant subroutine AIML::Common::LOCK_NB redefined at lib/AIML/Common.pm line 54.
Prototype mismatch: sub AIML::Common::LOCK_NB () vs none at lib/AIML/Common.pm line 54.
Constant subroutine AIML::Common::LOCK_UN redefined at lib/AIML/Common.pm line 55.
Prototype mismatch: sub AIML::Common::LOCK_UN () vs none at lib/AIML/Common.pm line 55.
Died at lib/AIML/Unicode.pm line 102.
Compilation failed in require at lib/AIML/Common.pm line 109.
BEGIN failed--compilation aborted at lib/AIML/Common.pm line 109.
Compilation failed in require at build.pl line 32.
BEGIN failed--compilation aborted at build.pl line 32.
The most interesting line to me was when it said Died at lib/AIML/Unicode.pm line 102.
without any error message (looks like a die;
statement in Perl with no message), so I looked at this line of this file, and it was doing this:
my $changer = do ( $pkg ) or die;
So I debugged it (read: added a print "$pkg\n";
above that line) and found it was trying to import unicode/To/Upper.pl
which was nowhere to be found. On my Linux system I ran a locate Upper.pl
command, and found that a similarly named file existed at /usr/share/perl5/unicore/To/Upper.pl
- the key difference is that "unicode" is spelled "unicore".
There were 3 lines of code in AIML::Unicode
that reference files like this and I changed all three to point to the "unicore" versions - fixed it! build.pl
would now make some progress.
It then complained about a couple of the AIML files containing illegal characters in their <pattern>
tags. No big deal, went in and fixed them. build.pl
runs successfully now! And then I ran shell.pl
and was dropped into an interactive chat session with an Alice bot.
As for those AIML::Common::LOCK_SH
warnings: I have to assume that in Perl 5.6, file locking (flock
) was either a new feature or not widely implemented, and the code was trying to do a few error checks (in a Perl 5.6 style way) and if flock
isn't found to be available, it would shim those constants itself. But, flock
is available, but the error checks were still going off, so AIML::Common
was overriding the constants. So, I just fixed the error checks and problem solved. ;)
So once I got it working, I published the updated version of Program V on my GitHub account for others to check it out.
This doesn't mean Program V is actively maintained again. It was abandoned by its author in 2002 and hasn't been able to run on modern Perl ever since; I simply updated it so it works again. If that inspires you, feel free to fork it and maintain it on your own - it was released by its author under the same terms as Perl itself.
There are 0 comments on this page. Add yours.
0.0109s
.