Add built local::lib
[catagits/Gitalist.git] / local-lib5 / man / man3 / Class::Inspector.3pm
1 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.3
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sh \" Subsection heading
6 .br
7 .if t .Sp
8 .ne 5
9 .PP
10 \fB\\$1\fR
11 .PP
12 ..
13 .de Sp \" Vertical space (when we can't use .PP)
14 .if t .sp .5v
15 .if n .sp
16 ..
17 .de Vb \" Begin verbatim text
18 .ft CW
19 .nf
20 .ne \\$1
21 ..
22 .de Ve \" End verbatim text
23 .ft R
24 .fi
25 ..
26 .\" Set up some character translations and predefined strings.  \*(-- will
27 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28 .\" double quote, and \*(R" will give a right double quote.  | will give a
29 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
30 .\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
31 .\" expand to `' in nroff, nothing in troff, for use with C<>.
32 .tr \(*W-|\(bv\*(Tr
33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34 .ie n \{\
35 .    ds -- \(*W-
36 .    ds PI pi
37 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
39 .    ds L" ""
40 .    ds R" ""
41 .    ds C` ""
42 .    ds C' ""
43 'br\}
44 .el\{\
45 .    ds -- \|\(em\|
46 .    ds PI \(*p
47 .    ds L" ``
48 .    ds R" ''
49 'br\}
50 .\"
51 .\" If the F register is turned on, we'll generate index entries on stderr for
52 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53 .\" entries marked with X<> in POD.  Of course, you'll have to process the
54 .\" output yourself in some meaningful fashion.
55 .if \nF \{\
56 .    de IX
57 .    tm Index:\\$1\t\\n%\t"\\$2"
58 ..
59 .    nr % 0
60 .    rr F
61 .\}
62 .\"
63 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
64 .\" way too many mistakes in technical documents.
65 .hy 0
66 .if n .na
67 .\"
68 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
70 .    \" fudge factors for nroff and troff
71 .if n \{\
72 .    ds #H 0
73 .    ds #V .8m
74 .    ds #F .3m
75 .    ds #[ \f1
76 .    ds #] \fP
77 .\}
78 .if t \{\
79 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80 .    ds #V .6m
81 .    ds #F 0
82 .    ds #[ \&
83 .    ds #] \&
84 .\}
85 .    \" simple accents for nroff and troff
86 .if n \{\
87 .    ds ' \&
88 .    ds ` \&
89 .    ds ^ \&
90 .    ds , \&
91 .    ds ~ ~
92 .    ds /
93 .\}
94 .if t \{\
95 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101 .\}
102 .    \" troff and (daisy-wheel) nroff accents
103 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110 .ds ae a\h'-(\w'a'u*4/10)'e
111 .ds Ae A\h'-(\w'A'u*4/10)'E
112 .    \" corrections for vroff
113 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115 .    \" for low resolution devices (crt and lpr)
116 .if \n(.H>23 .if \n(.V>19 \
117 \{\
118 .    ds : e
119 .    ds 8 ss
120 .    ds o a
121 .    ds d- d\h'-1'\(ga
122 .    ds D- D\h'-1'\(hy
123 .    ds th \o'bp'
124 .    ds Th \o'LP'
125 .    ds ae ae
126 .    ds Ae AE
127 .\}
128 .rm #[ #] #H #V #F C
129 .\" ========================================================================
130 .\"
131 .IX Title "Class::Inspector 3"
132 .TH Class::Inspector 3 "2009-04-20" "perl v5.8.7" "User Contributed Perl Documentation"
133 .SH "NAME"
134 Class::Inspector \- Get information about a class and its structure
135 .SH "SYNOPSIS"
136 .IX Header "SYNOPSIS"
137 .Vb 1
138 \&  use Class::Inspector;
139 .Ve
140 .PP
141 .Vb 3
142 \&  # Is a class installed and/or loaded
143 \&  Class::Inspector\->installed( 'Foo::Class' );
144 \&  Class::Inspector\->loaded( 'Foo::Class' );
145 .Ve
146 .PP
147 .Vb 3
148 \&  # Filename related information
149 \&  Class::Inspector\->filename( 'Foo::Class' );
150 \&  Class::Inspector\->resolved_filename( 'Foo::Class' );
151 .Ve
152 .PP
153 .Vb 5
154 \&  # Get subroutine related information
155 \&  Class::Inspector\->functions( 'Foo::Class' );
156 \&  Class::Inspector\->function_refs( 'Foo::Class' );
157 \&  Class::Inspector\->function_exists( 'Foo::Class', 'bar' );
158 \&  Class::Inspector\->methods( 'Foo::Class', 'full', 'public' );
159 .Ve
160 .PP
161 .Vb 2
162 \&  # Find all loaded subclasses or something
163 \&  Class::Inspector\->subclasses( 'Foo::Class' );
164 .Ve
165 .SH "DESCRIPTION"
166 .IX Header "DESCRIPTION"
167 Class::Inspector allows you to get information about a loaded class. Most or
168 all of this information can be found in other ways, but they aren't always
169 very friendly, and usually involve a relatively high level of Perl wizardry,
170 or strange and unusual looking code. Class::Inspector attempts to provide 
171 an easier, more friendly interface to this information.
172 .SH "METHODS"
173 .IX Header "METHODS"
174 .ie n .Sh "installed $class"
175 .el .Sh "installed \f(CW$class\fP"
176 .IX Subsection "installed $class"
177 The \f(CW\*(C`installed\*(C'\fR static method tries to determine if a class is installed
178 on the machine, or at least available to Perl. It does this by wrapping
179 around \f(CW\*(C`resolved_filename\*(C'\fR.
180 .PP
181 Returns true if installed/available, false if the class is not installed,
182 or \f(CW\*(C`undef\*(C'\fR if the class name is invalid.
183 .ie n .Sh "loaded $class"
184 .el .Sh "loaded \f(CW$class\fP"
185 .IX Subsection "loaded $class"
186 The \f(CW\*(C`loaded\*(C'\fR static method tries to determine if a class is loaded by
187 looking for symbol table entries.
188 .PP
189 This method it uses to determine this will work even if the class does not
190 have its own file, but is contained inside a single file with multiple
191 classes in it. Even in the case of some sort of run-time loading class
192 being used, these typically leave some trace in the symbol table, so an
193 Autoload or Class::Autouse\-based class should correctly appear
194 loaded.
195 .PP
196 Returns true if the class is loaded, false if not, or \f(CW\*(C`undef\*(C'\fR if the
197 class name is invalid.
198 .ie n .Sh "filename $class"
199 .el .Sh "filename \f(CW$class\fP"
200 .IX Subsection "filename $class"
201 For a given class, returns the base filename for the class. This will \s-1NOT\s0
202 be a fully resolved filename, just the part of the filename \s-1BELOW\s0 the
203 \&\f(CW@INC\fR entry.
204 .PP
205 .Vb 2
206 \&  print Class\->filename( 'Foo::Bar' );
207 \&  > Foo/Bar.pm
208 .Ve
209 .PP
210 This filename will be returned with the right seperator for the local
211 platform, and should work on all platforms.
212 .PP
213 Returns the filename on success or \f(CW\*(C`undef\*(C'\fR if the class name is invalid.
214 .ie n .Sh "resolved_filename $class\fP, \f(CW@try_first"
215 .el .Sh "resolved_filename \f(CW$class\fP, \f(CW@try_first\fP"
216 .IX Subsection "resolved_filename $class, @try_first"
217 For a given class, the \f(CW\*(C`resolved_filename\*(C'\fR static method returns the fully
218 resolved filename for a class. That is, the file that the class would be
219 loaded from.
220 .PP
221 This is not nescesarily the file that the class \s-1WAS\s0 loaded from, as the
222 value returned is determined each time it runs, and the \f(CW@INC\fR include
223 path may change.
224 .PP
225 To get the actual file for a loaded class, see the \f(CW\*(C`loaded_filename\*(C'\fR
226 method.
227 .PP
228 Returns the filename for the class, or \f(CW\*(C`undef\*(C'\fR if the class name is
229 invalid.
230 .ie n .Sh "loaded_filename $class"
231 .el .Sh "loaded_filename \f(CW$class\fP"
232 .IX Subsection "loaded_filename $class"
233 For a given loaded class, the \f(CW\*(C`loaded_filename\*(C'\fR static method determines
234 (via the \f(CW%INC\fR hash) the name of the file that it was originally loaded
235 from.
236 .PP
237 Returns a resolved file path, or false if the class did not have it's own
238 file.
239 .ie n .Sh "functions $class"
240 .el .Sh "functions \f(CW$class\fP"
241 .IX Subsection "functions $class"
242 For a loaded class, the \f(CW\*(C`functions\*(C'\fR static method returns a list of the
243 names of all the functions in the classes immediate namespace.
244 .PP
245 Note that this is not the \s-1METHODS\s0 of the class, just the functions.
246 .PP
247 Returns a reference to an array of the function names on success, or \f(CW\*(C`undef\*(C'\fR
248 if the class name is invalid or the class is not loaded.
249 .ie n .Sh "function_refs $class"
250 .el .Sh "function_refs \f(CW$class\fP"
251 .IX Subsection "function_refs $class"
252 For a loaded class, the \f(CW\*(C`function_refs\*(C'\fR static method returns references to
253 all the functions in the classes immediate namespace.
254 .PP
255 Note that this is not the \s-1METHODS\s0 of the class, just the functions.
256 .PP
257 Returns a reference to an array of \f(CW\*(C`CODE\*(C'\fR refs of the functions on
258 success, or \f(CW\*(C`undef\*(C'\fR if the class is not loaded.
259 .ie n .Sh "function_exists $class\fP, \f(CW$function"
260 .el .Sh "function_exists \f(CW$class\fP, \f(CW$function\fP"
261 .IX Subsection "function_exists $class, $function"
262 Given a class and function name the \f(CW\*(C`function_exists\*(C'\fR static method will
263 check to see if the function exists in the class.
264 .PP
265 Note that this is as a function, not as a method. To see if a method
266 exists for a class, use the \f(CW\*(C`can\*(C'\fR method for any class or object.
267 .PP
268 Returns true if the function exists, false if not, or \f(CW\*(C`undef\*(C'\fR if the
269 class or function name are invalid, or the class is not loaded.
270 .ie n .Sh "methods $class\fP, \f(CW@options"
271 .el .Sh "methods \f(CW$class\fP, \f(CW@options\fP"
272 .IX Subsection "methods $class, @options"
273 For a given class name, the \f(CW\*(C`methods\*(C'\fR static method will returns \s-1ALL\s0
274 the methods available to that class. This includes all methods available
275 from every class up the class' \f(CW@ISA\fR tree.
276 .PP
277 Returns a reference to an array of the names of all the available methods
278 on success, or \f(CW\*(C`undef\*(C'\fR if the class name is invalid or the class is not
279 loaded.
280 .PP
281 A number of options are available to the \f(CW\*(C`methods\*(C'\fR method that will alter
282 the results returned. These should be listed after the class name, in any
283 order.
284 .PP
285 .Vb 2
286 \&  # Only get public methods
287 \&  my $method = Class::Inspector\->methods( 'My::Class', 'public' );
288 .Ve
289 .IP "public" 4
290 .IX Item "public"
291 The \f(CW\*(C`public\*(C'\fR option will return only 'public' methods, as defined by the Perl
292 convention of prepending an underscore to any 'private' methods. The \f(CW\*(C`public\*(C'\fR 
293 option will effectively remove any methods that start with an underscore.
294 .IP "private" 4
295 .IX Item "private"
296 The \f(CW\*(C`private\*(C'\fR options will return only 'private' methods, as defined by the
297 Perl convention of prepending an underscore to an private methods. The
298 \&\f(CW\*(C`private\*(C'\fR option will effectively remove an method that do not start with an
299 underscore.
300 .Sp
301 \&\fBNote: The \f(CB\*(C`public\*(C'\fB and \f(CB\*(C`private\*(C'\fB options are mutually exclusive\fR
302 .IP "full" 4
303 .IX Item "full"
304 \&\f(CW\*(C`methods\*(C'\fR normally returns just the method name. Supplying the \f(CW\*(C`full\*(C'\fR option
305 will cause the methods to be returned as the full names. That is, instead of
306 returning \f(CW\*(C`[ 'method1', 'method2', 'method3' ]\*(C'\fR, you would instead get
307 \&\f(CW\*(C`[ 'Class::method1', 'AnotherClass::method2', 'Class::method3' ]\*(C'\fR.
308 .IP "expanded" 4
309 .IX Item "expanded"
310 The \f(CW\*(C`expanded\*(C'\fR option will cause a lot more information about method to be 
311 returned. Instead of just the method name, you will instead get an array
312 reference containing the method name as a single combined name, ala \f(CW\*(C`full\*(C'\fR,
313 the seperate class and method, and a \s-1CODE\s0 ref to the actual function ( if
314 available ). Please note that the function reference is not guarenteed to 
315 be available. \f(CW\*(C`Class::Inspector\*(C'\fR is intended at some later time, work 
316 with modules that have some some of common run-time loader in place ( e.g
317 \&\f(CW\*(C`Autoloader\*(C'\fR or \f(CW\*(C`Class::Autouse\*(C'\fR for example.
318 .Sp
319 The response from \f(CW\*(C`methods( 'Class', 'expanded' )\*(C'\fR would look something like
320 the following.
321 .Sp
322 .Vb 5
323 \&  [
324 \&    [ 'Class::method1',   'Class',   'method1', \e&Class::method1   ],
325 \&    [ 'Another::method2', 'Another', 'method2', \e&Another::method2 ],
326 \&    [ 'Foo::bar',         'Foo',     'bar',     \e&Foo::bar         ],
327 \&  ]
328 .Ve
329 .ie n .Sh "subclasses $class"
330 .el .Sh "subclasses \f(CW$class\fP"
331 .IX Subsection "subclasses $class"
332 The \f(CW\*(C`subclasses\*(C'\fR static method will search then entire namespace (and thus
333 \&\fBall\fR currently loaded classes) to find all classes that are subclasses
334 of the class provided as a the parameter.
335 .PP
336 The actual test will be done by calling \f(CW\*(C`isa\*(C'\fR on the class as a static
337 method. (i.e. \f(CW\*(C`My::Class\->isa($class)\*(C'\fR.
338 .PP
339 Returns a reference to a list of the loaded classes that match the class
340 provided, or false is none match, or \f(CW\*(C`undef\*(C'\fR if the class name provided
341 is invalid.
342 .SH "SUPPORT"
343 .IX Header "SUPPORT"
344 Bugs should be reported via the \s-1CPAN\s0 bug tracker
345 .PP
346 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Class\-Inspector>
347 .PP
348 For other issues, or commercial enhancement or support, contact the author.
349 .SH "AUTHOR"
350 .IX Header "AUTHOR"
351 Adam Kennedy <adamk@cpan.org>
352 .SH "SEE ALSO"
353 .IX Header "SEE ALSO"
354 <http://ali.as/>, Class::Handle
355 .SH "COPYRIGHT"
356 .IX Header "COPYRIGHT"
357 Copyright 2002 \- 2009 Adam Kennedy.
358 .PP
359 This program is free software; you can redistribute
360 it and/or modify it under the same terms as Perl itself.
361 .PP
362 The full text of the license can be found in the
363 \&\s-1LICENSE\s0 file included with this module.