[Xml-compile] XML::Compile::RPC suitable for use with MailChimp
API?
Mark Overmeer
mark at overmeer.net
Thu May 26 08:54:45 GMT 2011
* Mark Blackman (m.blackman at fairfx.com) [110524 16:55]:
> I'm trying to use the MailChimp API via XML::Compile::RPC, but I'm
> finding the generated result hashes far too verbose. In particular,
> the $response below is full of keys with names like 'name' and 'value'.
> Surely, XML::RPC should just map these into a hash?
XMLRPC interfaces do not have a specification, like XML messages with
a schema. However, data is typed and structured... and perl is not typed.
> struct_to_hash almost seems right, but isn't recursive. XML::RPC::Fast
> produces the hashes I expect and I would have though XML::Compile::RPC
> would as well.
To bridge the gap between typed/structured and untyped/other-structures,
you may DWIM. XML::RPC::Fast will probably dwim for you. But dwimming
can really bite you: it works mostly right but sometimes breaks. Ask
SOAP::Lite or XML::Simple users about maintaining their dwimming
implementations.
So, I am convinced that we should not dwim too much. I try to design the
module in a way that the code which survives simple regression tests will
also work for real-life input. This means: less dwimming, more explicit.
My XMLRPC implementation will not dwim element types, for instance.
Best way to go is providing a wrapper module, as shown in
XML::eXistDB::RPC. You can use that module to add more abstraction
between the raw XMLRPC and, for instance, nice Perl objects.
--
Regards,
MarkOv
------------------------------------------------------------------------
Mark Overmeer MSc MARKOV Solutions
Mark at Overmeer.net solutions at overmeer.net
http://Mark.Overmeer.net http://solutions.overmeer.net
More information about the Xml-compile
mailing list