Category: General
Perl for RiveScript-Java!I've just checked in an update to the RiveScript-java code:
It supports Perl objects now!
So you can use your existing RiveScript Perl objects with the Java library now. Example:
+ encode * in md5
- "<star> in MD5 is: <call>md5 <star></call>
> object md5 perl
my $rs = shift;
use Digest::MD5 qw(md5_hex);
return md5_hex(join(" ", @_));
< object
How does it work? There's a Perl script names "rsp4j.pl" that the Java library calls on. Java sends a JSON-encoded data structure to the Perl script containing the user's ID, message, user variables, and the source code to the Perl object. The Perl script loads the RiveScript Perl module and uses it to evaluate a response to the user. It then outputs a new JSON structure containing the user's reply and their new user variables (in case the Perl object called any setUservars methods on the $rs object).
The 0.02 version of rivescript-java has the Perl support. You can see its usage in the RSBot.java example script, or more generally here's all you need to do to get Perl support:
RiveScript rs = new RiveScript();
rs.setHandler("perl", new com.rivescript.lang.Perl(rs, "/path/to/rsp4j.pl");
I've written a quick RiveScript plugin for the XChat cross-platform IRC client. It basically lets you quickly and easily set up text macros/responses for your IRC client using RiveScript!
Example:
+ hello room * <get name> != undefined => Hello, <get name>! - Hello, <id>!You can download it from the new App Plugins page.
[ 0 comments | Add comment | Permalink ]
I've updated the Ubuntu package for RiveScript on the Interpreters page.
Similarly, the Fedora 11 RPM has been updated to use the new RPM build script so that the rsdemo and rsup scripts are installed as well.
Also, an RPM was added for CentOS 5.3, built using the new RPM build script.
The Ubuntu installer was derived from the RPM build script (the path to Perl had been fixed to be compatible with Debian and Ubuntu) and converted into a deb file via alien. It should install the same as in Fedora/CentOS and the rsdemo command-line tool should work.
The Ubuntu 9.10 RPM should also work with older versions of Ubuntu.
The "Downloads" page finally exists. It currently is a list of all the files that could be found on the root RiveScript site (which currently includes the Perl module and starter AIM bot template). Speaking of which, the starter AIM template has been updated to remove all of the backup files left behind by my text editor (the filenames ending in ~), which should be less confusing for Windows users now. :)
[ 0 comments | Add comment | Permalink ]
