Reputation: 3441
I'm using Frontier::Daemon to build a test library server for Robot Framework test automation framework. I got the test library server working for executing the code locally, but when it runs/executes over XML-RPC, that is when I run into problems. Part of the issue might also be because I'm using Perl reflection to execute test commands.
Maybe RPC::XML might be a better fit, but at the time I was developing the server, Frontier::Daemon seemed easier to start off with.
The Perl reflection code was borrowed from threads posted on this site as well as Wikipedia's page on code reflection (Perl section).
The code is hosted at Google Code, you can browse the code or check it out for review. The issue is described in more detail at the project site.
I was hoping the Perl developer community could give me some pointers on the source of the problem and how to fix it.
Thanks, Dave
Upvotes: 0
Views: 466
Reputation: 98398
There are a couple things you are missing. First, Frontier::Daemon calls the "methods" you provide it as simple subroutine calls, but your two provided methods expect to be called as methods of your remote server object. Change your code to do this:
my $svr = Frontier::Daemon->new(
methods => {
get_keyword_names => sub { $self->get_keyword_names(@_) },
run_keyword => sub { $self->run_keyword(@_) },
},
...
to call your methods as they seem to expect.
Second, your get_keyword_names tries to return an array, but the interface you are using seems to only allow a single return value and is calling the methods in scalar context, causing get_keyword_names to return the count of elements in the array. I think you want to be returning a reference to the array instead:
return \@methods;
Upvotes: 1