Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: Reference: tagChapter 17
The LWP Library
Next: 17.4 The HTML Module
 

traverse

 $h->traverse(sub, [ignoretext])

Traverses the current element and all of its children, invoking the callback routine sub for each element. The callback routine is called with a reference to the current element (the node), a startflag, and the depth as arguments. The start flag is 1 when entering a node and 0 when leaving (returning to a parent element). If the ignoretext parameter is true (the default), then the callback routine will not be invoked for text content. If the callback routine returns false, the method will not traverse any child elements of that node.


Previous: Reference: tagPerl in a NutshellNext: 17.4 The HTML Module
Reference: tagBook Index17.4 The HTML Module

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.