WebService-FuncNet
view release on metacpan or search on metacpan
lib/WebService/FuncNet/Results.pm view on Meta::CPAN
}
}
return $ra_output;
}
=head2 as_xml
Formats and returns the data in CSV format. Returns a scalar which contains the
XML markup. The root node is named 'results'.
B<Tip>: each pairwise result is stored
under an XML element named 'anon'. This way, you can use XMLin from XML::Simple
and reconstruct a reference to a array of anonymos hashes easily.
my $xml = $R->as_xml;
More information on the output of the function can be found at
L<http://funcnet.eu/wsdls/example-queries/>
Example output:
<results>
<anon>
<p1>Q9H8H3</p1>
<p2>O75865</p2>
<pv>0.8059660198021762</pv>
<rs>1.615708908613666</rs>
</anon>
<anon>
<p1>P22676</p1>
<p2>A3EXL0</p2>
<pv>0.9246652723089276</pv>
<rs>0.8992717754263188</rs>
</anon>
<anon>
<p1>Q5SR05</p1>
<p2>A3EXL0</p2>
<pv>0.9739920871688543</pv>
<rs>0.49493596412217056</rs>
</anon>
</results>
This function returns I<undef> on error.
=cut
sub as_xml {
my $self = shift;
my $rah_data = $self->{'data'};
return
unless ( defined $rah_data && ref $rah_data eq 'ARRAY' );
my $rah_sorted_data =
$self->prepare_data( $rah_data );
my $xml =
XML::Simple::XMLout(
$rah_sorted_data,
'AttrIndent' => 1,
'NoAttr' => 1,
'RootName' => 'results' );
if ( $xml ) {
return $xml;
} else {
carp 'Failed to create XML output';
return;
}
}
1;
=head1 REVISION INFO
Revision: $Rev: 64 $
Last editor: $Author: andrew_b_clegg $
Last updated: $Date: 2009-07-06 16:12:20 +0100 (Mon, 06 Jul 2009) $
The latest source code for this project can be checked out from:
https://funcnet.svn.sf.net/svnroot/funcnet/trunk
=cut
( run in 0.930 second using v1.01-cache-2.11-cpan-39bf76dae61 )