From: Wil C. <wc...@na...> - 2002-03-27 00:03:37
|
Also Sprach Jamie Cameron <jca...@we...> on Mon, Mar 18, 2002 at 05:= 39:14PM PST > The need for extra modules is part of the reason for not using XML-RPC, > but another is that (as far as I know) it doesn't support the passing > of complex structures as parameters or return values. Because many of > the remote webmin functions pass or return arrays and hashes, the lack > of structures really rules out XML-RPC, which only supports simple > types like strings and numbers. >=20 > Correct me if I am wrong about this though, because it probably wouldn't > be too hard to add some kind of gateway between XML-RPC and Webmin RPC > if they both have the same capabilities .. I've been thinking more about this, and the complex datastructures should pose no problem. I did a little looking around my Perl installation (including CPAN modules RH shipped) and found XML::Dumper, which will take a Perl structure and output XML. Here's an example from the man page: #!/usr/bin/perl # Convert Perl code to XML use XML::Dumper; my $dump =3D new XML::Dumper; $data =3D [ { first =3D> 'Jonathan', last =3D> 'Eisenzopf', email =3D> 'ei...@po...' }, { first =3D> 'Larry', last =3D> 'Wall', email =3D> ' la...@wa...' } ]; $xml =3D $dump->pl2xml($data); print $xml, "\n" ; # EOF Which produces: <perldata> <array> <item key=3D"0"> <hash> <item key=3D"last">Eisenzopf</item> <item key=3D"first">Jonathan</item> <item key=3D"email">ei...@po...</item> </hash> </item> <item key=3D"1"> <hash> <item key=3D"last">Wall</item> <item key=3D"first">Larry</item> <item key=3D"email"> la...@wa...</item> </hash> </item> </array> </perldata> Viol=E1! Wil --=20 W. Reilly Cooley wc...@na... Naked Ape Consulting http://nakedape.cc irc.linux.com #orlug,#lnxs "There was a vague, unpleasant manginess about his appearence; he somehow seemed dirty, though a close glance showed him as carefully shaven as an actor, and clad in immaculate linen." -- H.L. Mencken, on the death of William Jennings Bryan |