NAME XML::LibXML::LazyMatcher - A simple XML matcher with lazy evaluation. VERSION Version 0.01 SYNOPSIS my $dom = XML::LibXML->load_xml (string => "helloworld"); my $matcher; my ($c2content, $c3content); { package XML::LibXML::LazyMatcher; $matcher = M (root => C (M (c1 => C (M (c2 => sub { $c2content = $_[0]->textContent; return 1; }), M (c3 => sub { $c3content = $_[0]->textContent; return 1; }))))); } $matcher->($dom->documentElement); EXPORT None. SUBROUTINES/METHODS M (tagname => [sub_matcher, ...]) Returns a matcher function. This returned function takes an XML::LibXML::Node object as an argument. First, The matcher checks if the tag name of the passed node is correct, then, applies the node to all `sub_matcher's. If all `sub_matcher's return true value then the `M()' returns 1. Otherwise returns 0. You can define some action as a sub_matcher. A typical `sub_matcher' may be like this: sub { my $node = shift; # $node should be a XML::LibXML::Node. return 0 unless is_valid($node); do_some_action($node); return 1; } C (sub_matcher, ...) Creates a matcher function which tests all child nodes. If a sub_matcher returns true value, then the `C()' returns 1. Otherwise returns 0. AUTHOR Toru Hisai, `' BUGS Please report any bugs or feature requests to `bug-xml-libxml-lazymatcher at rt.cpan.org', or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=XML-LibXML-LazyMatcher. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. SUPPORT You can find documentation for this module with the perldoc command. perldoc XML::LibXML::LazyMatcher You can also look for information at: * RT: CPAN's request tracker http://rt.cpan.org/NoAuth/Bugs.html?Dist=XML-LibXML-LazyMatcher * AnnoCPAN: Annotated CPAN documentation http://annocpan.org/dist/XML-LibXML-LazyMatcher * CPAN Ratings http://cpanratings.perl.org/d/XML-LibXML-LazyMatcher * Search CPAN http://search.cpan.org/dist/XML-LibXML-LazyMatcher/ ACKNOWLEDGEMENTS LICENSE AND COPYRIGHT Copyright 2010 Toru Hisai. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information.