Jabber-RPC in Perl
Exciting as this recipe might be, it’s not very visual. There
are no screenshots of note to show, just a couple of STDOUTs from
two scripts started at the command line.
To fix this “problem,” we’re going to round this recipe off with a quick look
at Jabber-RPC in Perl. Based on the
Jabber::Connection library is a fairly
new Perl library called Jabber::RPC, which sports
two modules: Jabber::RPC::Client.pm and
Jabber::RPC::Server.pm.
If you’re slightly perplexed about what it takes to extend Jabber support in Java, take a look at Example 10-13 and Example 10-14. The first is an implementation, in Perl, of the JabberRPCResponder and all its class periphery. The second is an implementation of our JabberRPCRequester.
use strict; use Jabber::RPC::Server; my @county = ("Bedfordshire", "Berkshire", "Buckinghamshire", "Cambridgeshire", "Cheshire", "Cornwall", "Cumberland", "Derbyshire", "Devon", "Dorset", "Durham", "Essex", "Gloucestershire", "Hampshire", "Herefordshire", "Hertfordshire", "Humberside", "Huntingdonshire", "Kent", "Lancashire", "Leicestershire", "Lincolnshire", "London", "Middlesex", "Norfolk", "Northamptonshire", "Northumberland", "Nottinghamshire", "Oxfordshire", "Rutland", "Shropshire", "Somerset", "Staffordshire", "Suffolk", "Surrey", "Sussex", "Warwickshire", "Westmorland", "Wiltshire", "Worcestershire", "Yorkshire"); sub getCountyName { my $county = shift; return $county[$county - 1]; } my $server = new ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access