Barrie Slaymaker has just released XML::SAX::Machines to CPAN. For those of you who missed the announcement on the Perl-XML list, SAX::Machines is a SAX pipeline construction toolkit. It's lego for XML.
We were just now looking at neat ways you can do XML stuff on the command line with the current SAX based solutions. For example here's a passthru parser:
$ perl -MXML::SAX -MXML::SAX::Writer -wle 'XML::SAX::ParserFactory->parser( Handler => XML::SAX::Writer->new )->parse_string( q(<foo/>) )'
But then Barrie chimed in with this beauty, based on SAX::Machines:
$ perl -MXML::SAX::Machines=Pipeline -wle 'Pipeline( \*STDOUT )->parse_string( q(<foo/>) )'
SAX::Machines basically facilitates constructing SAX pipelines, and he's put some really cool facilities together so you can do this easily, including some mind blowing facilities for processing an XML document in record oriented fashion through whatever SAX engine you like. The "lego" bit is you simply pass in SAX filters or parsers or serialisers to the constructor (Pipeline in this case), and it manages the entire thing for you.
It's seriously cool technology. And I think Barrie is going to be doing an article about it some time soonish. I look forward to that.