S
ssims
Let me start by saying, please forgive me if this has been discussed
before...I searched the group and didn't see it anywhere. Now...
I'm trying to interface with a XML-RPC server provided by my professor
for an assignment. The service has the following methods:
getMethods - Takes no arguments and returns a list of the methods
contained in the service.
getPrice - Takes a string denoting the beer brand and returns a double
representing the beer price.
getBeers - Takes no arguments and returns a list of the known beers.
getCheapest - Takes no arguments and returns the name of the least
expensive beer.
getCostliest - Takes no arguments and returns the name of the most
expensive beer.
I'm fine getting single items returned, it's for the getMethods and
getBeers where I'm stuck. My code is as follows:
- - - - -[begin code]- - - - -
use Frontier::Client;
my $server_url = 'http://frisbee.rit.edu:8200';
my $server = Frontier::Client->new('url' => $server_url,debug);
my $result;
$result = $server->call('beer.getMethods');
print "Methods: " . $result . "\n";
$result = $server->call('beer.getPrice','Genesee');
print "Price for Genesee: " . $result . "\n";
$result = $server->call('beer.getBeers');
print "Beers: " . $result . "\n";
$result = $server->call('beer.getCheapest');
print "Cheapest: " . $result . "\n";
$result = $server->call('beer.getCostliest');
print "Costliest: " . $result . "\n";
- - - - -[end code]- - - - -
For the Methods and the Beers I get an ARRAY(0x...) value. I have
tried the standard array methods, like foreach(@array) { print $_ } and
foreach $item (@array) { print $item } and nothing seems to work. How
can I get the data from the "ARRAY()" object? The Frontier::Client
documentation doesn't shed any light, and the perl array documentation
hasn't been helpful as of yet. Thanks for any and all guidance.
-Sean
before...I searched the group and didn't see it anywhere. Now...
I'm trying to interface with a XML-RPC server provided by my professor
for an assignment. The service has the following methods:
getMethods - Takes no arguments and returns a list of the methods
contained in the service.
getPrice - Takes a string denoting the beer brand and returns a double
representing the beer price.
getBeers - Takes no arguments and returns a list of the known beers.
getCheapest - Takes no arguments and returns the name of the least
expensive beer.
getCostliest - Takes no arguments and returns the name of the most
expensive beer.
I'm fine getting single items returned, it's for the getMethods and
getBeers where I'm stuck. My code is as follows:
- - - - -[begin code]- - - - -
use Frontier::Client;
my $server_url = 'http://frisbee.rit.edu:8200';
my $server = Frontier::Client->new('url' => $server_url,debug);
my $result;
$result = $server->call('beer.getMethods');
print "Methods: " . $result . "\n";
$result = $server->call('beer.getPrice','Genesee');
print "Price for Genesee: " . $result . "\n";
$result = $server->call('beer.getBeers');
print "Beers: " . $result . "\n";
$result = $server->call('beer.getCheapest');
print "Cheapest: " . $result . "\n";
$result = $server->call('beer.getCostliest');
print "Costliest: " . $result . "\n";
- - - - -[end code]- - - - -
For the Methods and the Beers I get an ARRAY(0x...) value. I have
tried the standard array methods, like foreach(@array) { print $_ } and
foreach $item (@array) { print $item } and nothing seems to work. How
can I get the data from the "ARRAY()" object? The Frontier::Client
documentation doesn't shed any light, and the perl array documentation
hasn't been helpful as of yet. Thanks for any and all guidance.
-Sean