3 use OpenSRF::AppSession;
7 OpenSRF::System->bootstrap_client(config_file => '/openils/conf/opensrf_core.xml');
9 my $session = OpenSRF::AppSession->create("opensrf.simple-text");
11 print "substring: Accepts a string and a number as input, returns a string\n";
12 my $request = $session->request("opensrf.simple-text.substring", "foobar", 3);
15 while ($response = $request->recv()) {
16 print "Substring: " . $response->content . "\n\n";
19 print "split: Accepts two strings as input, returns an array of strings\n";
20 $request = $session->request("opensrf.simple-text.split", "This is a test", " ")->gather();
21 my $output = "Split: [";
22 foreach my $element (@$request) {
23 $output .= "$element, ";
26 print $output . "\n\n";
28 print "statistics: Accepts an array of strings as input, returns a hash\n";
30 "First I think I'll have breakfast",
31 "Then I think that lunch would be nice",
32 "And then seventy desserts to finish off the day"
35 $request = $session->request("opensrf.simple-text.statistics", @many_strings)->gather();
36 print "Length: " . $request->{'length'} . "\n";
37 print "Word count: " . $request->{'word_count'} . "\n";
39 $session->disconnect();