RPC::XML::Server make_method .xpl files - Not able to make system calls

X

Xeno

Hi,

I am using the Perl Module RCP::XML::Server. There I am using the method
"add_methods_in_dir". In this directory there are several .xpl files
located. Each file contains a function which provides functionality for the
RPC-XML-Client. So far this works fine.
Problem is that I have to make a system call within a function in the .xpl
file. And exactly this does not work. The function is very simple:

sub ifconfig {
my $result = `/sbin/ifconfig`;
return $result;
}

If I call this function within a simple perl script, it works fine. But if
I call this function within XML-RPC using the .xpl files, it does not work.
The .xpl file looks like this:

-----
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE methoddef SYSTEM "rpc-method.dtd">
<!--
Generated automatically by make_method v1.11, Mon Aug 7 18:13:40 2006

Any changes made here will be lost.
-->
<methoddef>
<name>network.ifconfig</name>
<signature>string</signature>
<help>
Output ifconfig
</help>
<code language="perl">
<![CDATA[
#!/usr/bin/perl
sub ifconfig {
my $result = `/sbin/ifconfig`;
return $result;
}
__END__
]]></code>
</methoddef>
-----


The RPC-Client calls the method like this:
$cli = RPC::XML::Client->new('http://localhost:10000/RPCSERV');
$resp = $cli->simple_request('network.ifconfig');

The error (print $RPC::XML::ERROR;) I get is:
-----
RPC::XML::Client::simple_request:
not well-formed (invalid token) at line 3, column 53, byte 285 at
/usr/share/perl5/RPC/XML/Client.pm line 345
-----

If I make the system call using the function system() instead of
backqoutes, I do not get any error. Anyway I also do not get any data. The
result is an empty variable.

Is anybody familiar with this technique and can help me?

Thanks
Xeno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top