aftershock has asked for the wisdom of the Perl Monks concerning the following question:

Hi, A while ago, I decided to use xmlrpc protocol for communicating through web. So I have a Perl script on my website which has something like this: my $server = RPC::Any::Server::XMLRPC::CGI->new( dispatch => { 'proc' => 'proc' }, send_nil => 0, allow_get => 0, ); so I have a proc that returns { ( $stderr, "\xFF\xFF$source","exit$exitcode"); } This rpc package guesses the xmlrpc types based on the returned parameters. I have a small problem if I return a string that contains a number , it is perceived as a number. E.g. "2" How do I force this package to treat a string as a string and not as a number?
  • Comment on A problem with RPC::Any::Server::XMLRPC::CGI

Replies are listed 'Best First'.
Re: A problem with RPC::Any::Server::XMLRPC::CGI
by dHarry (Abbot) on Sep 20, 2010 at 11:36 UTC

    I don't understand what's the problem, the 2 is a scalar, you can use it any way you like. See perldata. Maybe you can show some more code demonstrating the problem?

Re: A problem with RPC::Any::Server::XMLRPC::CGI
by trwww (Priest) on Sep 21, 2010 at 01:19 UTC
      RPC client is in another language... The problem is XMLRPC::CGI returns different parameters types depending on the situation.

      if "2" is passed back, some kind pf number type is returned.

      if "hello" is passed back, string type is returned.

      My client is not flexible to handle returned values which can change their types depending on the content.

        Ok, I found it.

        This is what have to be used.

        $RPC::XML::FORCE_STRING_ENCODING=1;