Alvis::Saa - Perl extension for communicating over the Tana protocol
use Alvis::Saa; my $saa=Alvis::Saa->new(); # Build a Tana message my %MSG=('command'=>'call', 'object'=>'tfidf', 'function'=>'query', 'max-results'=>10, 'snippets'=>'', 'accuracy'=>0.9, 'query-string'=>"some query"); $saa->queue($host, $port, $msg, arb_name => undef, arb => undef) || die($saa->{'err'} . "\n"); my($ok, $sent, $received, $pending); $received = []; $sent = []; while(scalar(@$sent) < 1) { ($ok, $sent, $received, $pending) = $saa->process(10); $ok || die($saa->{'err'} . "\n"); } if($wait) { while(scalar(@$received) < 1) { ($ok, $sent, $received, $pending) = $saa->process(10); $ok || die($saa->{'err'} . "\n"); } # do something with the results }
Provides a set of methods for sending and receiving Tana messages.
Creates a new instance.
Returns the current error message.
Starts listening to 'port'.
Are we connected to 'host':'port'?
Cut all connections.
Cut the connection to 'host':'port'.
Stop listening to 'port';
Connect to 'host':'port'.
Put message 'msg' into the queue for 'host':'port'. 'parameters' is a hash with the following parameters to set:
'tag' => client name for the message 'arb' => scalar data or func(tag) that returs scalar or undef on end-of-data 'arb_name' => scalar
Process the request with the given timeout in seconds.
Alvis::Tana
Antti Tuominen, <antti.tuominen@hiit.fi> Kimmo Valtonen, <kimmo.valtonen@hiit.fi>
Copyright (C) 2006 by Antti Tuominen, Kimmo Valtonen
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.
To install Alvis::Saa, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Alvis::Saa
CPAN shell
perl -MCPAN -e shell install Alvis::Saa
For more information on module installation, please visit the detailed CPAN module installation guide.