[DCPM] shorthand required
Aaron Trevena
aaron.trevena at gmail.com
Fri Feb 16 04:55:16 PST 2007
Hi Neil,
Your XML creation seems incredibly verbose.
I would suggest two things :
1) try using XML::DOM::BagOfTricks
(http://search.cpan.org/~teejay/XML-DOM-BagOfTricks-0.05/lib/XML/DOM/BagOfTricks.pm)
which allows you to do create complex XML tags in a single statement.
2) Create a dictionary holding source and destination fieldnames and
loop through that - a simple array of hashes (to preserve any
necessary ordering) should be fairly simple then you could do stuff
like:
$destination_object->$destination_fieldname($source_object->$source_fieldname)
if ($source_object->$source_fieldname);
Combining these two things should make your code a lot shorter, and
therefore easier to document.
cheers,
A.
--
http://www.aarontrevena.co.uk
LAMP System Integration, Development and Hosting
More information about the Devoncornwall-pm
mailing list