.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Tree::Simple::VisitorFactory 3pm" .TH Tree::Simple::VisitorFactory 3pm "2005-11-28" "perl v5.10.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Tree::Simple::VisitorFactory \- A factory object for dispensing Visitor objects .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Tree::Simple::VisitorFactory; \& \& my $tf = Tree::Simple::VisitorFactory\->new(); \& \& my $visitor = $tf\->get("PathToRoot"); \& \& # or call it as a class method \& my $visitor = Tree::Simple::VisitorFactory\->getVisitor("PathToRoot"); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This object is really just a factory for dispensing Tree::Simple::Visitor::* objects. It is not required to use this package in order to use all the Visitors, it is just a somewhat convienient way to avoid having to type thier long class names. .PP I considered making this a Singleton, but I did not because I thought that some people might not want that. I know that I am very picky about using Singletons, especially in multiprocess environments like mod_perl, so I implemented the smallest instance I knew how to, and made sure all other methods could be called as class methods too. .SH "METHODS" .IX Header "METHODS" .IP "\fBnew\fR" 4 .IX Item "new" Returns an minimal instance of this object, basically just a reference back to the package (literally, see the source if you care). .IP "\fBget ($visitor_type)\fR" 4 .IX Item "get ($visitor_type)" Attempts to load the \f(CW$visitor_type\fR and returns an instance of it if successfull. If no \f(CW$visitor_type\fR is specified an exception is thrown, if \f(CW$visitor_type\fR fails to load, and exception is thrown. .IP "\fBgetVisitor ($visitor_type)\fR" 4 .IX Item "getVisitor ($visitor_type)" This is an alias of \f(CW\*(C`get\*(C'\fR. .SH "AVAILABLE VISITORS" .IX Header "AVAILABLE VISITORS" This distibution provides a number of Visitor objects which can be loaded just by giving their name. Below is a description of the available Visitors and a sort description of what they do. I have attempted to classify the Visitors into groups which are related to their use. .PP This factory will load any module contained inside the \fBTree::Simple::Visitor::*\fR namespace. Given a name, it will attempt to \f(CW\*(C`require\*(C'\fR the module \fBTree::Simple::Visitor::<\f(BIName\fB>.pm\fR. This allows others to create Visitors which can be accessed with this factory, without needed to include them in this distrobution. .SS "Search/Path Related Visitors" .IX Subsection "Search/Path Related Visitors" .IP "\fBPathToRoot\fR" 4 .IX Item "PathToRoot" Given a Tree::Simple object, this Visitor will find the path back to the tree's root node. .IP "\fBFindByPath\fR" 4 .IX Item "FindByPath" Given a path and Tree::Simple hierarchy, this Visitor will attempt to find the node specified by the path. .IP "\fBFindByUID\fR" 4 .IX Item "FindByUID" Given a \s-1UID\s0 and Tree::Simple hierarchy, this Visitor will attempt to find the node with the same \s-1UID\s0. .IP "\fBFindByNodeValue\fR" 4 .IX Item "FindByNodeValue" Given a node value and Tree::Simple hierarchy, this Visitor will attempt to find the node with the same node value. .SS "Traversal Visitors" .IX Subsection "Traversal Visitors" .IP "\fBBreadthFirstTraversal\fR" 4 .IX Item "BreadthFirstTraversal" This implements a breadth-first traversal of a Tree::Simple hierarchy. .IP "\fBPostOrderTraversal\fR" 4 .IX Item "PostOrderTraversal" Post-order traversal is a variation of the depth-first traversal in which the sub-tree's are processed \fIbefore\fR the parent. .IP "\fBPreOrderTraversal\fR" 4 .IX Item "PreOrderTraversal" Pre-order traversal is a depth-first traversal method in which the sub-tree's are processed \fIafter\fR the parent. .SS "FileSystem Visitors" .IX Subsection "FileSystem Visitors" .IP "\fBLoadDirectoryTree\fR" 4 .IX Item "LoadDirectoryTree" This visitor can be used to load a directory tree into a Tree::Simple hierarchy. .IP "\fBCreateDirectoryTree\fR" 4 .IX Item "CreateDirectoryTree" This visitor can be used to create a set of directories and files from a Tree::Simple object hierarchy. .SS "Conversion Visitors" .IX Subsection "Conversion Visitors" .IP "\fBFromNestedArray\fR" 4 .IX Item "FromNestedArray" Given a tree constructed from nested arrays, this Visitor will create the equivalent Tree::Simple heirarchy. .IP "\fBToNestedArray\fR" 4 .IX Item "ToNestedArray" Given a Tree::Simple heirarchy, this Visitor will create the equivalent tree constructed from nested arrays. .IP "\fBFromNestedHash\fR" 4 .IX Item "FromNestedHash" Given a tree constructed from nested hashs, this Visitor will create the equivalent Tree::Simple heirarchy. .IP "\fBToNestedHash\fR" 4 .IX Item "ToNestedHash" Given a Tree::Simple heirarchy, this Visitor will create the equivalent tree constructed from nested hashes. .SS "Reflective Visitors" .IX Subsection "Reflective Visitors" .IP "\fBLoadClassHierarchy\fR" 4 .IX Item "LoadClassHierarchy" Given a class name or instance, this Visitor will create a Tree::Simple hierarchy which models the classes inheritance heirarchy. .SS "Misc. Visitors" .IX Subsection "Misc. Visitors" .IP "\fBGetAllDescendents\fR" 4 .IX Item "GetAllDescendents" Given a Tree::Simple instance this Visitor will return all the descendents recursively on down the hierarchy. .IP "\fBSort\fR" 4 .IX Item "Sort" This implements a multi-level sort of a Tree::Simple heirarchy. .IP "\fBVariableDepthClone\fR" 4 .IX Item "VariableDepthClone" A Visitor for cloning parts of Tree::Simple hierarchy .SH "BUGS" .IX Header "BUGS" None that I am aware of. Of course, if you find a bug, let me know, and I will be sure to fix it. .SH "CODE COVERAGE" .IX Header "CODE COVERAGE" I use \fBDevel::Cover\fR to test the code coverage of my tests, below is the \fBDevel::Cover\fR report on this module test suite. .PP .Vb 10 \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \& File stmt branch cond sub pod time total \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \& Tree/Simple/VisitorFactory.pm 100.0 100.0 n/a 100.0 100.0 0.4 100.0 \& Tree/Simple/Visitor/BreadthFirstTraversal.pm 100.0 100.0 66.7 100.0 100.0 2.5 96.3 \& Tree/Simple/Visitor/PostOrderTraversal.pm 100.0 100.0 77.8 100.0 100.0 1.7 96.3 \& Tree/Simple/Visitor/PreOrderTraversal.pm 100.0 n/a 33.3 100.0 100.0 0.7 90.5 \& Tree/Simple/Visitor/CreateDirectoryTree.pm 100.0 85.7 86.7 100.0 100.0 3.4 95.8 \& Tree/Simple/Visitor/LoadClassHierarchy.pm 100.0 73.1 33.3 100.0 100.0 4.9 89.2 \& Tree/Simple/Visitor/LoadDirectoryTree.pm 100.0 89.3 85.2 100.0 100.0 26.1 94.7 \& Tree/Simple/Visitor/FindByNodeValue.pm 100.0 100.0 86.7 100.0 100.0 3.1 98.3 \& Tree/Simple/Visitor/FindByPath.pm 100.0 100.0 66.7 100.0 100.0 1.2 97.9 \& Tree/Simple/Visitor/FindByUID.pm 100.0 100.0 86.7 100.0 100.0 2.9 98.3 \& Tree/Simple/Visitor/GetAllDescendents.pm 100.0 100.0 77.8 100.0 100.0 2.3 97.1 \& Tree/Simple/Visitor/PathToRoot.pm 100.0 87.5 75.0 100.0 100.0 0.8 95.1 \& Tree/Simple/Visitor/Sort.pm 100.0 100.0 77.8 100.0 100.0 8.8 98.1 \& Tree/Simple/Visitor/ToNestedArray.pm 100.0 100.0 66.7 100.0 100.0 1.5 96.5 \& Tree/Simple/Visitor/ToNestedHash.pm 100.0 100.0 66.7 100.0 100.0 1.4 96.5 \& Tree/Simple/Visitor/FromNestedArray.pm 100.0 94.4 81.8 100.0 100.0 8.1 96.6 \& Tree/Simple/Visitor/FromNestedHash.pm 100.0 91.7 77.8 100.0 100.0 4.8 95.9 \& Tree/Simple/Visitor/VariableDepthClone.pm 100.0 100.0 66.7 100.0 100.0 25.5 97.3 \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \& Total 100.0 93.8 76.3 100.0 100.0 100.0 96.1 \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\- .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" These Visitor classes are meant to work with Tree::Simple hierarchies, you should refer to that module for more information. .SH "AUTHOR" .IX Header "AUTHOR" stevan little, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright 2004, 2005 by Infinity Interactive, Inc. .PP .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.