apu has asked for the wisdom of the Perl Monks concerning the following question:

There's an existing, internal database we can't mess with, only read from, and a new project that needs data from this database, developed by a third-party. I need to build some middleware to make the two talk. Following Example 1 from the XML::Generator::DBI Tutorial, I have a working solution that reads data from the database and returns XML to the third-party system. But I need to do some data cleanup in my middleware.

For example, some of the entries in the database have years associated with them, and some do not. Except, instead of a null value, there is a 0. So I need to change 0 to null before returning my XML. There are a couple other fields that need similar tweaks.

How do I "intercept" the data flow between XML::Generator::DBI and XML::Handler::YAWriter so that I can make the changes that Perl is so good at doing?

Replies are listed 'Best First'.
Re: Change data on the fly (DBI to XML)
by talexb (Chancellor) on Jun 10, 2016 at 15:50 UTC

    I haven't used it for a while, but XML::Twig worked well for me when I used it. It lets you peek into the tree and adjust as necessary.

    Alex / talexb / Toronto

    Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.