It seems the Frontier::Client only expects to return simple values, not arrays. You'll have to go down to the Frontier::RPC2 level and do "decode" calls for yourself. Here's an example:
sub doCommand { # Decode the results of the raw command from XML. my ($uri, $coder, @rest) = @_; my $encoded = doRawCommand($uri, $coder, @rest); return $encoded if ($encoded eq ""); my $result; # Decode XML RPC wrapper case. my $decoded = $coder->decode($encoded); # Note: the result is an array ref with params inside $result = $decoded->{value}[0]; return $result; }

Update: I should explain that doRawCommand is a routine I wrote to encode and make an XML-RPC request, and that $coder is an instance of Frontier::RPC2.

Update2: One thing about your original code is that Frontier::Client::call will never return an array of values, even if the decoding had worked. It should be able to do an array reference, though.

Update3: I just tried an encoding example, trying to match what Advogato returns:

use strict; use Frontier::RPC2; my $coder = Frontier::RPC2->new(use_objects => 1); my $result = [ "you guessed", 42 ]; my $xml_string = $coder->encode_response($result); print $xml_string,"\n";
This is the result I got:
<?xml version="1.0"?> <methodResponse> <params> <param><value><array><data> <value><string>you guessed</string></value><value><i4>42</i4></value>< +/data></array></value> </param> </params> </methodResponse>
The difference is a "value" tag around the "array" level. I believe that is what is throwing off your decode. Advogato must be using a different version of the encoding scheme.

I would suggest asking their support board. If they can't help, you could use a wrapper like my subroutine above and munge the return value to the right syntax before decoding it.


In reply to Re: Getting an XML-RPC array with Frontier::Client by tall_man
in thread Getting an XML-RPC array with Frontier::Client by jaldhar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.