IceWalkers.com - Linux Software downloads and news
Name : Password :
Linux SoftwareLinux RPMLinux HowtosLink UsAboutAdvertise

Data::Grove::Visitor

 Perl Doc. Index   Quick jump:  
 

NAME

Data::Grove::Visitor - add visitor/callback methods to Data::Grove objects

SYNOPSIS
 use Data::Grove::Visitor;
 @results = $object->accept ($visitor, ...);
 @results = $object->accept_name ($visitor, ...);
 @results = $object->children_accept ($visitor, ...);
 @results = $object->children_accept_name ($visitor, ...);
DESCRIPTION

Data::Grove::Visitor adds visitor methods (callbacks) to Data::Grove objects. A ``visitor'' is a class (a package) you write that has methods (subs) corresponding to the objects in the classes being visited. You use the visitor methods by creating an instance of your visitor class, and then calling `accept($my_visitor)' on the top-most object you want to visit, that object will in turn call your visitor back with `visit_OBJECT', where OBJECT is the type of object.

There are several forms of `accept'. Simply calling `accept' calls your package back using the object type of the object you are visiting. Calling `accept_name' on an element object calls you back with `visit_name_NAME' where NAME is the tag name of the element, on all other objects it's as if you called `accept'.

All of the forms of `accept' return a concatenated list of the result of all `visit' methods.

`children_accept' calls `accept' on each of the children of the element. This is generally used in element callbacks to recurse down into the element's children, you don't need to get the element's contents and call `accept' on each item. `children_accept_name' does the same but calling `accept_name' on each of the children. `attr_accept' calls `accept' on each of the objects in the named attribute.

Refer to the documentation of the classes you are visiting (XML::Grove, etc.) for the type names (`element', `document', etc.) of the objects it implements.

RESERVED NAMES

The hash keys `Contents' and `Name' are used to indicate objects with children (for `children_accept') and named objects (for `accept_name').

NOTES

These are random ideas that haven't been implemented yet:

  • Several objects fall into subclasses, or you may want to be able to subclass a visited object and still be able to tell the difference. In SGML::Grove I had used the package name in the callback (`visit_SGML_Element') instead of a generic name (`visit_element'). The idea here would be to try calling `visit_PACKAGE' with the most specific class first, then try superclasses, and lastly to try the generic.
AUTHOR

Ken MacLeod,

SEE ALSO

perl(1), Data::Grove

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

 Perl Doc. Index   Quick jump:  
 
Inkscape 0.47
Vector graphic editor for SVG
DeleGate 9.9.6-pre5
Proxy server which runs on multiple platforms
Nano 2.1.99pre2
Emulate Pico while also offering a few enhancements.
My Money 2.0.49
Personal financial software
Linux Kernel 2.6 2.6.32-rc8
Linux Kernel
GCstar 1.5.0
Personal collections manager
ImageMagick 6.5.7.9
ImageMagick image processing studio
BibleTime 2.4
Bible study software for Linux / KDE
Tellico 2.1.1
Collection manager for books, music, videos, and bibliographies
Totem 2.28.4
Movie player for Gnome
Free IT Magazines, White Papers, eBooks, and more !
Oracle Magazine

Contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more.

Vulnerability Management for Dummies

Get all the Facts and See How to Implement a Successful Vulnerability Management Program.

Website Magazine

Has tapped premier talent in the Internet industry for our content and each and every issue will contain practical advice and insights for website owners.

Linux Software Map
Find Linux RPM
Best Rated Linux Software
Most Rated Linux Software
Linux Distributions
Linux Howtos
Quick Survey

Please take our survey and help us improve our website to serve you better.

Thank you.
Linux Software
Linux / IT Resources
Site Resources
Google
Privacy Policy
Contact Us
Submit Software
Advertising info