Tuesday, July 08, 2008

Perl SAMP Alpha 3

I've just brought my pre-Trieste Perl Hub and test clients into line with the post-Trieste Working Draft document that Mark Taylor pushed to the SAMP mailing list at the tail end of June. Both the Perl Hub and the clients have been tested with Mark's Java SAMP kit pre-release and Luigi Paioro's SAMPY alpha 1 release. This release is being tagged alpha3, and is available under the terms of version 2 of the GPL license.

The new Perl Hub currently lacks callAndWait( ) functionality, I'll be adding that in this week, but should in all other ways meet the 1.0 WD and be interoperable with the other emerging toolkits.

Apart from a quick update towards the end of the week to add callAndWait( ), which will be tagged alpha4, this will be the last 'initial' release. After this I'll take some time to clean up the code, add some documentation, and make the client toolkit a bit more pleasant to use before making a 'first' release.

However if you want to get your feet dirty ahead of that, you'll need the following Perl modules installed: XMLRPC::Lite (part of the SOAP::Lite module), XML::Simple, DateTime, File::Spec, Carp, Data::Dumper, Getopt::Long, Socket, Net::Domain, POSIX and Errno. Depending on your version of Perl some, but not all, of these will ship with the core distribution. The rest can be obtained from CPAN. I think I've caught all the dependancies, but if you notice any I haven't listed any let me know I've forgotten them.

As with my initial release of the prototype SAMP Hub back at the start of May, the code comes with no guarantees except there will be horrendous bugs. There is no documentation. Many of the Perl modules have inline POD, however most of it didn't keep up with the pace of development so it's out of date. However, once you install the additional modules, open up a terminal window and start the Hub as follows,

% tar -zxvf perl-samp-hub-alpha3.tar.gz
% cd perl-samp-hub-alpha3/
% ./samp_hub.pl

you can put the Hub through its paces by opening up two more terminal windows and running the testbed clients. You should start the listener client in all cases,

% tar -zxvf perl-samp-clients-alpha3.tar.gz
% cd perl-samp-clients-alpha3/
% ./listener_client.pl

this is the test client that listens for notify( ) and call( )'s from the Hub. In the second window you can either start the client that exercises the notify( ) method, or the other than exercises the call( ) method. So

% cd perl-samp-clients-alpha3/
% ./callAll_test.pl


% cd perl-samp-clients-alpha3/
% ./notifyAll_test.pl

These two clients have a heart beat which will dispatch a call or a notification periodically. The first heartbeat will happen 15 seconds (or so) after the client has completed its registering with the Hub.

As always, feedback is appreciated...

Update: There is now a binary release of the Hub for x86_64 Linux and Intel Mac OSX. Just download the relevant zip file, unzip the executable, and run it. The dependencies, including Perl itself, should be taken care of using the magic of the Perl Packager.

Update: Apparently the x86_64 binary is fairly sensitive to installed library versions. This could just be my unfamiliarity with the packager. Reports of working, and non-working, installations would be good. Advice by people more familiar with PAR::Packer than I am would be warmly welcomed.