XML::Grove::Sub(3pm) - phpMan

Command: man perldoc info search(apropos)  


XML::Grove::Sub(3pm)           User Contributed Perl Documentation           XML::Grove::Sub(3pm)

NAME
       XML::Grove::Sub - run a filter sub over a grove

SYNOPSIS
        use XML::Grove::Sub;

        # Using filter method on XML::Grove::Document or XML::Grove::Element:
        @results = $grove_object->filter(\&sub [, ...]);

        # Using an XML::Grove::Sub instance:
        $filterer = XML::Grove::Sub->new();
        @results = $grove_object->accept($filterer, \&sub [, ...]);

DESCRIPTION
       "XML::Grove::Sub" executes a sub, the filter, over all objects in a grove and returns a
       list of all the return values from the sub.  The sub is called with the grove object as
       it's first parameter and passing the rest of the arguments to the call to `"filter()"' or
       `"accept()"'.

EXAMPLE
       The following filter will return a list of all `"foo"' or `"bar"' elements with an
       attribute `"widget-no"' beginning with `"A"' or `"B"'.

         @results = $grove_obj->filter(sub {
             my $obj = shift;

             if ($obj->isa('XML::Grove::Element')
                 && (($obj->{Name} eq 'foo')
                     || ($obj->{Name} eq 'bar'))
                 && ($obj->{Attributes}{'widget-no'} =~ /^[AB]/)) {
                 return ($obj);
             }
             return ();
         });

AUTHOR
       Ken MacLeod, ken AT bitsko.us

SEE ALSO
       perl(1), XML::Grove(3), Data::Grove::Visitor(3)

       Extensible Markup Language (XML) <http://www.w3c.org/XML>

perl v5.32.0                                2021-01-04                       XML::Grove::Sub(3pm)

Generated by $Id: phpMan.php,v 4.55 2007/09/05 04:42:51 chedong Exp $ Author: Che Dong
On Apache
Under GNU General Public License
2025-02-21 13:27 @3.22.250.18 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0!Valid CSS!