Add built local::lib
[catagits/Gitalist.git] / local-lib5 / man / man3 / Params::Util.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 "Params::Util 3"
132 .TH Params::Util 3 "2009-05-30" "perl v5.8.7" "User Contributed Perl Documentation"
133 .SH "NAME"
134 Params::Util \- Simple, compact and correct param\-checking functions
135 .SH "SYNOPSIS"
136 .IX Header "SYNOPSIS"
137 .Vb 2
138 \&  # Import some functions
139 \&  use Params::Util qw{_SCALAR _HASH _INSTANCE};
140 .Ve
141 .PP
142 .Vb 2
143 \&  # If you are lazy, or need a lot of them...
144 \&  use Params::Util ':ALL';
145 .Ve
146 .PP
147 .Vb 6
148 \&  sub foo {
149 \&      my $object  = _INSTANCE(shift, 'Foo') or return undef;
150 \&      my $image   = _SCALAR(shift)          or return undef;
151 \&      my $options = _HASH(shift)            or return undef;
152 \&      # etc...
153 \&  }
154 .Ve
155 .SH "DESCRIPTION"
156 .IX Header "DESCRIPTION"
157 \&\f(CW\*(C`Params::Util\*(C'\fR provides a basic set of importable functions that makes
158 checking parameters a hell of a lot easier
159 .PP
160 While they can be (and are) used in other contexts, the main point
161 behind this module is that the functions \fBboth\fR Do What You Mean,
162 and Do The Right Thing, so they are most useful when you are getting
163 params passed into your code from someone and/or somewhere else
164 and you can't really trust the quality.
165 .PP
166 Thus, \f(CW\*(C`Params::Util\*(C'\fR is of most use at the edges of your \s-1API\s0, where
167 params and data are coming in from outside your code.
168 .PP
169 The functions provided by \f(CW\*(C`Params::Util\*(C'\fR check in the most strictly
170 correct manner known, are documented as thoroughly as possible so their
171 exact behaviour is clear, and heavily tested so make sure they are not
172 fooled by weird data and Really Bad Things.
173 .PP
174 To use, simply load the module providing the functions you want to use
175 as arguments (as shown in the \s-1SYNOPSIS\s0).
176 .PP
177 To aid in maintainability, \f(CW\*(C`Params::Util\*(C'\fR will \fBnever\fR export by
178 default.
179 .PP
180 You must explicitly name the functions you want to export, or use the
181 \&\f(CW\*(C`:ALL\*(C'\fR param to just have it export everything (although this is not
182 recommended if you have any _FOO functions yourself with which future
183 additions to \f(CW\*(C`Params::Util\*(C'\fR may clash)
184 .SH "FUNCTIONS"
185 .IX Header "FUNCTIONS"
186 .ie n .Sh "_STRING $string"
187 .el .Sh "_STRING \f(CW$string\fP"
188 .IX Subsection "_STRING $string"
189 The \f(CW\*(C`_STRING\*(C'\fR function is intended to be imported into your
190 package, and provides a convenient way to test to see if a value is
191 a normal non-false string of non-zero length.
192 .PP
193 Note that this will \s-1NOT\s0 do anything magic to deal with the special
194 \&\f(CW'0'\fR false negative case, but will return it.
195 .PP
196 .Vb 2
197 \&  # '0' not considered valid data
198 \&  my $name = _STRING(shift) or die "Bad name";
199 .Ve
200 .PP
201 .Vb 2
202 \&  # '0' is considered valid data
203 \&  my $string = _STRING($_[0]) ? shift : die "Bad string";
204 .Ve
205 .PP
206 Please also note that this function expects a normal string. It does
207 not support overloading or other magic techniques to get a string.
208 .PP
209 Returns the string as a conveince if it is a valid string, or
210 \&\f(CW\*(C`undef\*(C'\fR if not.
211 .ie n .Sh "_IDENTIFIER $string"
212 .el .Sh "_IDENTIFIER \f(CW$string\fP"
213 .IX Subsection "_IDENTIFIER $string"
214 The \f(CW\*(C`_IDENTIFIER\*(C'\fR function is intended to be imported into your
215 package, and provides a convenient way to test to see if a value is
216 a string that is a valid Perl identifier.
217 .PP
218 Returns the string as a convenience if it is a valid identifier, or
219 \&\f(CW\*(C`undef\*(C'\fR if not.
220 .ie n .Sh "_CLASS $string"
221 .el .Sh "_CLASS \f(CW$string\fP"
222 .IX Subsection "_CLASS $string"
223 The \f(CW\*(C`_CLASS\*(C'\fR function is intended to be imported into your
224 package, and provides a convenient way to test to see if a value is
225 a string that is a valid Perl class.
226 .PP
227 This function only checks that the format is valid, not that the
228 class is actually loaded. It also assumes \*(L"normalised\*(R" form, and does
229 not accept class names such as \f(CW\*(C`::Foo\*(C'\fR or \f(CW\*(C`D'Oh\*(C'\fR.
230 .PP
231 Returns the string as a convenience if it is a valid class name, or
232 \&\f(CW\*(C`undef\*(C'\fR if not.
233 .ie n .Sh "_CLASSISA $string\fP, \f(CW$class"
234 .el .Sh "_CLASSISA \f(CW$string\fP, \f(CW$class\fP"
235 .IX Subsection "_CLASSISA $string, $class"
236 The \f(CW\*(C`_CLASSISA\*(C'\fR function is intended to be imported into your
237 package, and provides a convenient way to test to see if a value is
238 a string that is a particularly class, or a subclass of it.
239 .PP
240 This function checks that the format is valid and calls the \->isa
241 method on the class name. It does not check that the class is actually
242 loaded.
243 .PP
244 It also assumes \*(L"normalised\*(R" form, and does
245 not accept class names such as \f(CW\*(C`::Foo\*(C'\fR or \f(CW\*(C`D'Oh\*(C'\fR.
246 .PP
247 Returns the string as a convenience if it is a valid class name, or
248 \&\f(CW\*(C`undef\*(C'\fR if not.
249 .ie n .Sh "_SUBCLASS $string\fP, \f(CW$class"
250 .el .Sh "_SUBCLASS \f(CW$string\fP, \f(CW$class\fP"
251 .IX Subsection "_SUBCLASS $string, $class"
252 The \f(CW\*(C`_SUBCLASS\*(C'\fR function is intended to be imported into your
253 package, and provides a convenient way to test to see if a value is
254 a string that is a subclass of a specified class.
255 .PP
256 This function checks that the format is valid and calls the \->isa
257 method on the class name. It does not check that the class is actually
258 loaded.
259 .PP
260 It also assumes \*(L"normalised\*(R" form, and does
261 not accept class names such as \f(CW\*(C`::Foo\*(C'\fR or \f(CW\*(C`D'Oh\*(C'\fR.
262 .PP
263 Returns the string as a convenience if it is a valid class name, or
264 \&\f(CW\*(C`undef\*(C'\fR if not.
265 .ie n .Sh "_NUMBER $scalar"
266 .el .Sh "_NUMBER \f(CW$scalar\fP"
267 .IX Subsection "_NUMBER $scalar"
268 The \f(CW\*(C`_NUMBER\*(C'\fR function is intended to be imported into your
269 package, and provides a convenient way to test to see if a value is
270 a number. That is, it is defined and perl thinks it's a number.
271 .PP
272 This function is basically a Params::Util\-style wrapper around the
273 Scalar::Util \f(CW\*(C`looks_like_number\*(C'\fR function.
274 .PP
275 Returns the value as a convience, or \f(CW\*(C`undef\*(C'\fR if the value is not a
276 number.
277 .ie n .Sh "_POSINT $integer"
278 .el .Sh "_POSINT \f(CW$integer\fP"
279 .IX Subsection "_POSINT $integer"
280 The \f(CW\*(C`_POSINT\*(C'\fR function is intended to be imported into your
281 package, and provides a convenient way to test to see if a value is
282 a positive integer (of any length).
283 .PP
284 Returns the value as a convience, or \f(CW\*(C`undef\*(C'\fR if the value is not a
285 positive integer.
286 .PP
287 The name itself is derived from the \s-1XML\s0 schema constraint of the same
288 name.
289 .ie n .Sh "_NONNEGINT $integer"
290 .el .Sh "_NONNEGINT \f(CW$integer\fP"
291 .IX Subsection "_NONNEGINT $integer"
292 The \f(CW\*(C`_NONNEGINT\*(C'\fR function is intended to be imported into your
293 package, and provides a convenient way to test to see if a value is
294 a non-negative integer (of any length). That is, a positive integer,
295 or zero.
296 .PP
297 Returns the value as a convience, or \f(CW\*(C`undef\*(C'\fR if the value is not a
298 non-negative integer.
299 .PP
300 As with other tests that may return false values, care should be taken
301 to test via \*(L"defined\*(R" in boolean validy contexts.
302 .PP
303 .Vb 3
304 \&  unless ( defined _NONNEGINT($value) ) {
305 \&     die "Invalid value";
306 \&  }
307 .Ve
308 .PP
309 The name itself is derived from the \s-1XML\s0 schema constraint of the same
310 name.
311 .Sh "_SCALAR \e$scalar"
312 .IX Subsection "_SCALAR $scalar"
313 The \f(CW\*(C`_SCALAR\*(C'\fR function is intended to be imported into your package,
314 and provides a convenient way to test for a raw and unblessed
315 \&\f(CW\*(C`SCALAR\*(C'\fR reference, with content of non-zero length.
316 .PP
317 For a version that allows zero length \f(CW\*(C`SCALAR\*(C'\fR references, see
318 the \f(CW\*(C`_SCALAR0\*(C'\fR function.
319 .PP
320 Returns the \f(CW\*(C`SCALAR\*(C'\fR reference itself as a convenience, or \f(CW\*(C`undef\*(C'\fR
321 if the value provided is not a \f(CW\*(C`SCALAR\*(C'\fR reference.
322 .Sh "_SCALAR0 \e$scalar"
323 .IX Subsection "_SCALAR0 $scalar"
324 The \f(CW\*(C`_SCALAR0\*(C'\fR function is intended to be imported into your package,
325 and provides a convenient way to test for a raw and unblessed
326 \&\f(CW\*(C`SCALAR0\*(C'\fR reference, allowing content of zero\-length.
327 .PP
328 For a simpler \*(L"give me some content\*(R" version that requires non-zero
329 length, \f(CW\*(C`_SCALAR\*(C'\fR function.
330 .PP
331 Returns the \f(CW\*(C`SCALAR\*(C'\fR reference itself as a convenience, or \f(CW\*(C`undef\*(C'\fR
332 if the value provided is not a \f(CW\*(C`SCALAR\*(C'\fR reference.
333 .ie n .Sh "_ARRAY $value"
334 .el .Sh "_ARRAY \f(CW$value\fP"
335 .IX Subsection "_ARRAY $value"
336 The \f(CW\*(C`_ARRAY\*(C'\fR function is intended to be imported into your package,
337 and provides a convenient way to test for a raw and unblessed
338 \&\f(CW\*(C`ARRAY\*(C'\fR reference containing \fBat least\fR one element of any kind.
339 .PP
340 For a more basic form that allows zero length \s-1ARRAY\s0 references, see
341 the \f(CW\*(C`_ARRAY0\*(C'\fR function.
342 .PP
343 Returns the \f(CW\*(C`ARRAY\*(C'\fR reference itself as a convenience, or \f(CW\*(C`undef\*(C'\fR
344 if the value provided is not an \f(CW\*(C`ARRAY\*(C'\fR reference.
345 .ie n .Sh "_ARRAY0 $value"
346 .el .Sh "_ARRAY0 \f(CW$value\fP"
347 .IX Subsection "_ARRAY0 $value"
348 The \f(CW\*(C`_ARRAY0\*(C'\fR function is intended to be imported into your package,
349 and provides a convenient way to test for a raw and unblessed
350 \&\f(CW\*(C`ARRAY\*(C'\fR reference, allowing \f(CW\*(C`ARRAY\*(C'\fR references that contain no
351 elements.
352 .PP
353 For a more basic \*(L"An array of something\*(R" form that also requires at
354 least one element, see the \f(CW\*(C`_ARRAY\*(C'\fR function.
355 .PP
356 Returns the \f(CW\*(C`ARRAY\*(C'\fR reference itself as a convenience, or \f(CW\*(C`undef\*(C'\fR
357 if the value provided is not an \f(CW\*(C`ARRAY\*(C'\fR reference.
358 .ie n .Sh "_ARRAYLIKE $value"
359 .el .Sh "_ARRAYLIKE \f(CW$value\fP"
360 .IX Subsection "_ARRAYLIKE $value"
361 The \f(CW\*(C`_ARRAYLIKE\*(C'\fR function tests whether a given scalar value can respond to
362 array dereferencing.  If it can, the value is returned.  If it cannot,
363 \&\f(CW\*(C`_ARRAYLIKE\*(C'\fR returns \f(CW\*(C`undef\*(C'\fR.
364 .ie n .Sh "_HASH $value"
365 .el .Sh "_HASH \f(CW$value\fP"
366 .IX Subsection "_HASH $value"
367 The \f(CW\*(C`_HASH\*(C'\fR function is intended to be imported into your package,
368 and provides a convenient way to test for a raw and unblessed
369 \&\f(CW\*(C`HASH\*(C'\fR reference with at least one entry.
370 .PP
371 For a version of this function that allows the \f(CW\*(C`HASH\*(C'\fR to be empty,
372 see the \f(CW\*(C`_HASH0\*(C'\fR function.
373 .PP
374 Returns the \f(CW\*(C`HASH\*(C'\fR reference itself as a convenience, or \f(CW\*(C`undef\*(C'\fR
375 if the value provided is not an \f(CW\*(C`HASH\*(C'\fR reference.
376 .ie n .Sh "_HASH0 $value"
377 .el .Sh "_HASH0 \f(CW$value\fP"
378 .IX Subsection "_HASH0 $value"
379 The \f(CW\*(C`_HASH0\*(C'\fR function is intended to be imported into your package,
380 and provides a convenient way to test for a raw and unblessed
381 \&\f(CW\*(C`HASH\*(C'\fR reference, regardless of the \f(CW\*(C`HASH\*(C'\fR content.
382 .PP
383 For a simpler \*(L"A hash of something\*(R" version that requires at least one
384 element, see the \f(CW\*(C`_HASH\*(C'\fR function.
385 .PP
386 Returns the \f(CW\*(C`HASH\*(C'\fR reference itself as a convenience, or \f(CW\*(C`undef\*(C'\fR
387 if the value provided is not an \f(CW\*(C`HASH\*(C'\fR reference.
388 .ie n .Sh "_HASHLIKE $value"
389 .el .Sh "_HASHLIKE \f(CW$value\fP"
390 .IX Subsection "_HASHLIKE $value"
391 The \f(CW\*(C`_HASHLIKE\*(C'\fR function tests whether a given scalar value can respond to
392 hash dereferencing.  If it can, the value is returned.  If it cannot,
393 \&\f(CW\*(C`_HASHLIKE\*(C'\fR returns \f(CW\*(C`undef\*(C'\fR.
394 .ie n .Sh "_CODE $value"
395 .el .Sh "_CODE \f(CW$value\fP"
396 .IX Subsection "_CODE $value"
397 The \f(CW\*(C`_CODE\*(C'\fR function is intended to be imported into your package,
398 and provides a convenient way to test for a raw and unblessed
399 \&\f(CW\*(C`CODE\*(C'\fR reference.
400 .PP
401 Returns the \f(CW\*(C`CODE\*(C'\fR reference itself as a convenience, or \f(CW\*(C`undef\*(C'\fR
402 if the value provided is not an \f(CW\*(C`CODE\*(C'\fR reference.
403 .ie n .Sh "_CODELIKE $value"
404 .el .Sh "_CODELIKE \f(CW$value\fP"
405 .IX Subsection "_CODELIKE $value"
406 The \f(CW\*(C`_CODELIKE\*(C'\fR is the more generic version of \f(CW\*(C`_CODE\*(C'\fR. Unlike \f(CW\*(C`_CODE\*(C'\fR,
407 which checks for an explicit \f(CW\*(C`CODE\*(C'\fR reference, the \f(CW\*(C`_CODELIKE\*(C'\fR function
408 also includes things that act like them, such as blessed objects that
409 overload \f(CW'&{}'\fR.
410 .PP
411 Please note that in the case of objects overloaded with '&{}', you will
412 almost always end up also testing it in 'bool' context at some stage.
413 .PP
414 For example:
415 .PP
416 .Vb 7
417 \&  sub foo {
418 \&      my $code1 = _CODELIKE(shift) or die "No code param provided";
419 \&      my $code2 = _CODELIKE(shift);
420 \&      if ( $code2 ) {
421 \&           print "Got optional second code param";
422 \&      }
423 \&  }
424 .Ve
425 .PP
426 As such, you will most likely always want to make sure your class has
427 at least the following to allow it to evaluate to true in boolean
428 context.
429 .PP
430 .Vb 2
431 \&  # Always evaluate to true in boolean context
432 \&  use overload 'bool' => sub () { 1 };
433 .Ve
434 .PP
435 Returns the callable value as a convenience, or \f(CW\*(C`undef\*(C'\fR if the
436 value provided is not callable.
437 .PP
438 Note \- This function was formerly known as _CALLABLE but has been renamed
439 for greater symmetry with the other _XXXXLIKE functions.
440 .PP
441 The use of _CALLABLE has been deprecated. It will continue to work, but
442 with a warning, until end\-2006, then will be removed.
443 .PP
444 I apologise for any inconvenience caused.
445 .ie n .Sh "_INVOCANT $value"
446 .el .Sh "_INVOCANT \f(CW$value\fP"
447 .IX Subsection "_INVOCANT $value"
448 This routine tests whether the given value is a valid method invocant.
449 This can be either an instance of an object, or a class name.
450 .PP
451 If so, the value itself is returned.  Otherwise, \f(CW\*(C`_INVOCANT\*(C'\fR
452 returns \f(CW\*(C`undef\*(C'\fR.
453 .ie n .Sh "_INSTANCE $object\fP, \f(CW$class"
454 .el .Sh "_INSTANCE \f(CW$object\fP, \f(CW$class\fP"
455 .IX Subsection "_INSTANCE $object, $class"
456 The \f(CW\*(C`_INSTANCE\*(C'\fR function is intended to be imported into your package,
457 and provides a convenient way to test for an object of a particular class
458 in a strictly correct manner.
459 .PP
460 Returns the object itself as a convenience, or \f(CW\*(C`undef\*(C'\fR if the value
461 provided is not an object of that type.
462 .ie n .Sh "_REGEX $value"
463 .el .Sh "_REGEX \f(CW$value\fP"
464 .IX Subsection "_REGEX $value"
465 The \f(CW\*(C`_REGEX\*(C'\fR function is intended to be imported into your package,
466 and provides a convenient way to test for a regular expression.
467 .PP
468 Returns the value itself as a convenience, or \f(CW\*(C`undef\*(C'\fR if the value
469 provided is not a regular expression.
470 .ie n .Sh "_SET \e@array, $class"
471 .el .Sh "_SET \e@array, \f(CW$class\fP"
472 .IX Subsection "_SET @array, $class"
473 The \f(CW\*(C`_SET\*(C'\fR function is intended to be imported into your package,
474 and provides a convenient way to test for set of at least one object of
475 a particular class in a strictly correct manner.
476 .PP
477 The set is provided as a reference to an \f(CW\*(C`ARRAY\*(C'\fR of objects of the
478 class provided.
479 .PP
480 For an alternative function that allows zero-length sets, see the
481 \&\f(CW\*(C`_SET0\*(C'\fR function.
482 .PP
483 Returns the \f(CW\*(C`ARRAY\*(C'\fR reference itself as a convenience, or \f(CW\*(C`undef\*(C'\fR if
484 the value provided is not a set of that class.
485 .ie n .Sh "_SET0 \e@array, $class"
486 .el .Sh "_SET0 \e@array, \f(CW$class\fP"
487 .IX Subsection "_SET0 @array, $class"
488 The \f(CW\*(C`_SET0\*(C'\fR function is intended to be imported into your package,
489 and provides a convenient way to test for a set of objects of a
490 particular class in a strictly correct manner, allowing for zero objects.
491 .PP
492 The set is provided as a reference to an \f(CW\*(C`ARRAY\*(C'\fR of objects of the
493 class provided.
494 .PP
495 For an alternative function that requires at least one object, see the
496 \&\f(CW\*(C`_SET\*(C'\fR function.
497 .PP
498 Returns the \f(CW\*(C`ARRAY\*(C'\fR reference itself as a convenience, or \f(CW\*(C`undef\*(C'\fR if
499 the value provided is not a set of that class.
500 .Sh "_HANDLE"
501 .IX Subsection "_HANDLE"
502 The \f(CW\*(C`_HANDLE\*(C'\fR function is intended to be imported into your package,
503 and provides a convenient way to test whether or not a single scalar
504 value is a file handle.
505 .PP
506 Unfortunately, in Perl the definition of a file handle can be a little
507 bit fuzzy, so this function is likely to be somewhat imperfect (at first
508 anyway).
509 .PP
510 That said, it is implement as well or better than the other file handle
511 detectors in existance (and we stole from the best of them).
512 .ie n .Sh "_DRIVER $string"
513 .el .Sh "_DRIVER \f(CW$string\fP"
514 .IX Subsection "_DRIVER $string"
515 .Vb 4
516 \&  sub foo {
517 \&    my $class = _DRIVER(shift, 'My::Driver::Base') or die "Bad driver";
518 \&    ...
519 \&  }
520 .Ve
521 .PP
522 The \f(CW\*(C`_DRIVER\*(C'\fR function is intended to be imported into your
523 package, and provides a convenient way to load and validate
524 a driver class.
525 .PP
526 The most common pattern when taking a driver class as a parameter
527 is to check that the name is a class (i.e. check against _CLASS)
528 and then to load the class (if it exists) and then ensure that
529 the class returns true for the isa method on some base driver name.
530 .PP
531 Return the value as a convenience, or \f(CW\*(C`undef\*(C'\fR if the value is not
532 a class name, the module does not exist, the module does not load,
533 or the class fails the isa test.
534 .SH "TO DO"
535 .IX Header "TO DO"
536 \&\- Add _CAN to help resolve the UNIVERSAL::can debacle
537 .PP
538 \&\- Would be even nicer if someone would demonstrate how the hell to
539 build a Module::Install dist of the ::Util dual Perl/XS type. :/
540 .PP
541 \&\- Implement an assertion-like version of this module, that dies on
542 error.
543 .PP
544 \&\- Implement a Test:: version of this module, for use in testing
545 .SH "SUPPORT"
546 .IX Header "SUPPORT"
547 Bugs should be reported via the \s-1CPAN\s0 bug tracker at
548 .PP
549 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Params\-Util>
550 .PP
551 For other issues, contact the author.
552 .SH "AUTHOR"
553 .IX Header "AUTHOR"
554 Adam Kennedy <adamk@cpan.org>
555 .SH "SEE ALSO"
556 .IX Header "SEE ALSO"
557 Params::Validate
558 .SH "COPYRIGHT"
559 .IX Header "COPYRIGHT"
560 Copyright 2005 \- 2009 Adam Kennedy.
561 .PP
562 This program is free software; you can redistribute
563 it and/or modify it under the same terms as Perl itself.
564 .PP
565 The full text of the license can be found in the
566 \&\s-1LICENSE\s0 file included with this module.