blib/lib/Params/SomeUtil.pm

filter: Statementstmt 94.5% 103 / 109 Branchbran 82.0% 87 / 106 Conditioncond 94.6% 88 / 93 MC/DCmcdc 86.6% 39 / 45 Subroutinesub 100% 21 / 21 Podpod n/a totaltotal 90.3% 338 / 374 CC 85 SCAR 15.5
CC
85
Cov
90%
_HANDLE
11.6
_CLASSDOES
6.3
_DRIVER
6.0
CRAP 4.7
↑ Summary SomeUtil.xs »
1 package Params::SomeUtil;
2  
3 =pod
4  
5 =head1 NAME
6  
7 Params::SomeUtil - Simple, compact and correct param-checking functions
8  
9 =head1 SYNOPSIS
10  
11 # Import some functions
12 use Params::SomeUtil qw{_SCALAR _HASH _INSTANCE};
13
14 # If you are lazy, or need a lot of them...
15 use Params::SomeUtil ':ALL';
16
17 sub foo {
18 my $object = _INSTANCE(shift, 'Foo') or return undef;
19 my $image = _SCALAR(shift) or return undef;
20 my $options = _HASH(shift) or return undef;
21 # etc...
22 }
23  
24 =head1 DESCRIPTION
25  
26 C<Params::SomeUtil> provides a basic set of importable functions that makes
27 checking parameters a hell of a lot easier. This module is a fork
28 of version 1.07 of L<Params::Util> with some additional bug fixes, see L</WHY>
29 below.
30  
31 While they can be (and are) used in other contexts, the main point
32 behind this module is that the functions B<both> Do What You Mean,
33 and Do The Right Thing, so they are most useful when you are getting
34 params passed into your code from someone and/or somewhere else
35 and you can't really trust the quality.
36  
37 Thus, C<Params::SomeUtil> is of most use at the edges of your API, where
38 params and data are coming in from outside your code.
39  
40 The functions provided by C<Params::SomeUtil> check in the most strictly
41 correct manner known, are documented as thoroughly as possible so their
42 exact behaviour is clear, and heavily tested so make sure they are not
43 fooled by weird data and Really Bad Things.
44  
45 To use, simply load the module providing the functions you want to use
46 as arguments (as shown in the SYNOPSIS).
47  
48 To aid in maintainability, C<Params::SomeUtil> will B<never> export by
49 default.
50  
51 You must explicitly name the functions you want to export, or use the
52 C<:ALL> param to just have it export everything (although this is not
53 recommended if you have any _FOO functions yourself with which future
54 additions to C<Params::SomeUtil> may clash)
55  
56 =head1 WHY
57  
58 L<Params::Util> already exists and has for some time. Unfortunately,
59 while the current maintainer has accepted patches to the project's
60 git repository, he refuses to make new releases of the module. I
61 offered to help cut a new release but refused citing "quality" as an
62 issue without elaborating, thus this fork. This module includes
63 the following changes that were applied after 1.07:
64  
65 =over 4
66  
67 =item Fix for L<RT#87649|https://rt.cpan.org/Public/Bug/Display.html?id=87649>
68 and L<RT#87649|https://rt.cpan.org/Public/Bug/Display.html?id=87649>
69  
70 These are for _CLASS and _POSINT, with similar fixes for _STRING,
71 _IDENTIFIER, _NUMBER and _NONNEGINT.
72  
73 =item Fix for L<RT#115910|https://rt.cpan.org/Public/Bug/Display.html?id=115910>
74  
75 But without the Americanised "corrections".
76  
77 =back
78  
79 These are the intentional differences from L<Params::Util>:
80  
81 =over 4
82  
83 =item XS build is unchanged from 1.07
84  
85 Although some improvements can likely be made here (patches welcome), the changes made
86 since 1.07 have broken the ability to install this module without a compiler.
87  
88 =item PP versions of functions are not in a separate module
89  
90 There us currently no C<Params::SomeUtil::PP>. There probably should be, and may
91 later be, but for now I wanted to make the minimum changes to make this viable.
92 (patches welcome)
93  
94 =item Fix for L<RT#5561|https://rt.cpan.org/Public/Bug/Display.html?id=75561>
95  
96 The XS versions of _ARRAY, _ARRAY0, _HASH and _HASH0 were inconsistent with the pure-perl
97 versions, and the documentation. The suggested fixes in the ticket were applied for
98 _ARRAY and _HASH. It was clear to me from reading the documentation that _ARRAY0 and
99 _HASH0 also had the same bug so they have also been corrected.
100  
101 =item Missing _CLASSCAN, _INSTANCECAN and _INVOCANTCAN
102  
103 Upstream L<Params::Util> added these to avoid the C<UNIVERSAL::can> pitfall
104 (calling C<can> as a function bypasses any overridden C<can> method), but only
105 in the unreleased 1.105_001 developer release. Since there hasn't been a public
106 release of L<Params::Util> that includes them, they are not implemented here.
107 We will consider implementing them if and when there is one.
108  
109 If you're using a new enough Perl to have the core C<isa> operator (5.32+,
110 stable since 5.36), it's worth reaching for that instead: C<< $thing isa
111 $class >> dispatches safely without a dependency, for the common case where a
112 class/instance relationship check is all you need.
113  
114 =back
115  
116 This is as of L<Params::Util> version 1.102, which is the current version as of this writing.
117 If there is a release of L<Params::Util> I will endevour to update this list.
118  
119 My preference would be for releases of L<Params::Util> resume and for it to be
120 maintained by someone responsive to tickets. I am not a direct user of L<Params::Util>,
121 or L<Params::SomeUtil> and I do not particularly want to maintain this module,
122 but given the way the CPAN ecosystem works this seems to strangely be the "easiest"
123 way to work around the challenge that I have.
124  
125 I would love to retire this module and make it a compatibility layer if it becomes unnecessary.
126  
127 =head1 FUNCTIONS
128  
129 =cut
130  
131 19 ▶use 5.00503;
Subroutine BEGIN: called CC=1 SCAR=0.0
132 19 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
133 19 require overload;
134 19 require Exporter;
135 19 require Scalar::Util;
136 19 require DynaLoader;
137  
138 19 ▶use vars qw{$VERSION @ISA @EXPORT_OK %EXPORT_TAGS};
Subroutine BEGIN: called CC=1 SCAR=0.0
139  
140 19 $VERSION = '1.12';
141 19 @ISA = qw{
142 Exporter
143 DynaLoader
144 };
145 19 @EXPORT_OK = qw{
146 _STRING _IDENTIFIER
147 _CLASS _CLASSISA _SUBCLASS _DRIVER _CLASSDOES
148 _NUMBER _POSINT _NONNEGINT
149 _SCALAR _SCALAR0
150 _ARRAY _ARRAY0 _ARRAYLIKE
151 _HASH _HASH0 _HASHLIKE
152 _CODE _CODELIKE
153 _INVOCANT _REGEX _INSTANCE _INSTANCEDOES
154 _SET _SET0
155 _HANDLE
156 };
157 19 %EXPORT_TAGS = ( ALL => \@EXPORT_OK );
158  
159 eval {
160 10 ▶ local $ENV{PERL_DL_NONLAZY} = 0 if $ENV{PERL_DL_NONLAZY};
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"PERL_DL_NONLAZY"} 10 0 10
161 10 bootstrap Params::SomeUtil $VERSION;
162 10 1;
163 19 ▶} unless $ENV{PERL_PARAMS_UTIL_PP} || $ENV{PERL_PARAMS_SOMEUTIL_PP};
Branch: 1 branch
BranchTrueFalseTotal
unless $ENV{"PERL_PARAMS_UTIL_PP"} or $ENV{"PERL_PARAMS_SOMEUTIL_PP"} 10 9 19
Condition100%3/3
$ENV{"PERL_PARAMS_UTIL_PP"} or $ENV{"PERL_PARAMS_SOMEUTIL_PP"}
l!l&&r!l&&!r
11440
MC/DC50%1/2
$ENV{"PERL_PARAMS_UTIL_PP"} or $ENV{"PERL_PARAMS_SOMEUTIL_PP"}
$ENV{"PERL_PARAMS_UTIL_PP"} $ENV{"PERL_PARAMS_SOMEUTIL_PP"}
Truth table66%2/3
A or B
A= $ENV{"PERL_PARAMS_UTIL_PP"}B= $ENV{"PERL_PARAMS_SOMEUTIL_PP"}
ABresult
1X1
011
000
164  
165 # Use a private pure-perl copy of looks_like_number if the version of
166 # Scalar::Util is old (for whatever reason).
167 19 ▶my $SU = eval "$Scalar::Util::VERSION" || 0;
Condition100%3/3
eval "$Scalar::Util::VERSION" || 0
l!l
31126
MC/DC0%0/1
eval "$Scalar::Util::VERSION" || 0
eval "$Scalar::Util::VERSION"
Truth table50%1/2
A
A= eval "$Scalar::Util::VERSION"
Aresult
11
00
168 19 ▶if ( $SU >= 1.18 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($SU >= 1.18) { } 19 0 19
169 19 Scalar::Util->import('looks_like_number');
170 } else {
171 0 eval <<'END_PERL';
172 sub looks_like_number {
173 local $_ = shift;
174  
175 # checks from perlfaq4
176 return 0 if !defined($_);
177 if (ref($_)) {
178 return overload::Overloaded($_) ? defined(0 + $_) : 0;
179 }
180 return 1 if (/^[+-]?[0-9]+$/); # is a +/- integer
181 return 1 if (/^([+-]?)(?=[0-9]|\.[0-9])[0-9]*(\.[0-9]*)?([Ee]([+-]?[0-9]+))?$/); # a C float
182 return 1 if ($] >= 5.008 and /^(Inf(inity)?|NaN)$/i) or ($] >= 5.006001 and /^Inf$/i);
183  
184 0;
185 }
186 END_PERL
187 }
188  
189  
190  
191  
192  
193 #####################################################################
194 # Param Checking Functions
195  
196 =pod
197  
198 =head2 _STRING $string
199  
200 The C<_STRING> function is intended to be imported into your
201 package, and provides a convenient way to test to see if a value is
202 a normal non-false string of non-zero length.
203  
204 Note that this will NOT do anything magic to deal with the special
205 C<'0'> false negative case, but will return it.
206  
207 # '0' not considered valid data
208 my $name = _STRING(shift) or die "Bad name";
209
210 # '0' is considered valid data
211 my $string = _STRING($_[0]) ? shift : die "Bad string";
212  
213 Please also note that this function expects a normal string. It does
214 not support overloading or other magic techniques to get a string.
215  
216 Returns the string as a convenience if it is a valid string, or
217 C<undef> if not.
218  
219 =cut
220  
221 19 ▶eval <<'END_PERL' unless defined &_STRING;
Subroutine _STRING: called CC=4 SCAR=13.9
Branch: 2 branches
BranchTrueFalseTotal
unless defined &Params::SomeUtil::_STRING 9 10 19
defined $_[0] && !ref($_[0]) && length $_[0] ? : 36 14 50
Condition100%6/6
defined $_[0] and not ref $_[0] and length $_[0]
!ll&&!rl&&r
16447
defined $_[0] and not ref $_[0]
!ll&&!rl&&r
131638
MC/DC100%3/3
defined $_[0] and not ref $_[0] and length $_[0]
defined $_[0] not ref $_[0] length $_[0]
Truth table100%4/4
A and not(B) and C
A= defined $_[0]B= not ref $_[0]C= length $_[0]
ABCresult
0XX0
10X0
1100
1111
222 sub _STRING ($) {
223 # Unlike _IDENTIFIER/_CLASS/_POSINT/etc (rt#81276), this does not
224 # copy $_[0] to a lexical first. Those needed the copy because a
225 # capture-less regex match against an aliased $1 clears $1 (and
226 # thus $_[0]) as a side effect. length() performs no match/mutation,
227 # so $_[0] is safe to use directly here even when passed $1.
228 (defined $_[0] and ! ref $_[0] and length($_[0])) ? $_[0] : undef;
229 }
230 END_PERL
231  
232 =pod
233  
234 =head2 _IDENTIFIER $string
235  
236 The C<_IDENTIFIER> 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 valid Perl identifier.
239  
240 Returns the string as a convenience if it is a valid identifier, or
241 C<undef> if not.
242  
243 =cut
244  
245 76 ▶eval <<'END_PERL' unless defined &_IDENTIFIER;
Subroutine _IDENTIFIER: called CC=4 SCAR=13.9
Branch: 2 branches
BranchTrueFalseTotal
defined $arg && !ref($arg) && $arg =~ /^[^\W\d]\w*\z/s ? : 32 44 76
unless defined &Params::SomeUtil::_IDENTIFIER 19 0 19
Condition100%6/6
defined $arg and not ref $arg and $arg =~ /^[^\W\d]\w*\z/s
!ll&&!rl&&r
242032
defined $arg and not ref $arg
!ll&&!rl&&r
42052
MC/DC100%3/3
defined $arg and not ref $arg and $arg =~ /^[^\W\d]\w*\z/s
defined $arg not ref $arg $arg =~ /^[^\W\d]\w*\z/s
Truth table100%4/4
A and not(B) and C
A= defined $argB= not ref $argC= $arg =~ /^[^\W\d]\w*\z/s
ABCresult
0XX0
10X0
1100
1111
246 sub _IDENTIFIER ($) {
247 my $arg = shift;
248 (defined $arg and ! ref $arg and $arg =~ m/^[^\W\d]\w*\z/s) ? $arg : undef;
249 }
250 END_PERL
251  
252 =pod
253  
254 =head2 _CLASS $string
255  
256 The C<_CLASS> function is intended to be imported into your
257 package, and provides a convenient way to test to see if a value is
258 a string that is a valid Perl class.
259  
260 This function only checks that the format is valid, not that the
261 class is actually loaded. It also assumes "normalised" form, and does
262 not accept class names such as C<::Foo> or C<D'Oh>.
263  
264 Returns the string as a convenience if it is a valid class name, or
265 C<undef> if not.
266  
267 =cut
268  
269 152 ▶eval <<'END_PERL' unless defined &_CLASS;
Subroutine _CLASS: called CC=4 SCAR=13.9
Branch: 2 branches
BranchTrueFalseTotal
defined $arg && !ref($arg) && $arg =~ /^[^\W\d]\w*(?:::\w+)*\z/s ? : 74 78 152
unless defined &Params::SomeUtil::_CLASS 19 0 19
Condition100%6/6
defined $arg and not ref $arg and $arg =~ /^[^\W\d]\w*(?:::\w+)*\z/s
!ll&&!rl&&r
384074
defined $arg and not ref $arg
!ll&&!rl&&r
632114
MC/DC100%3/3
defined $arg and not ref $arg and $arg =~ /^[^\W\d]\w*(?:::\w+)*\z/s
defined $arg not ref $arg $arg =~ /^[^\W\d]\w*(?:::\w+)*\z/s
Truth table100%4/4
A and not(B) and C
A= defined $argB= not ref $argC= $arg =~ /^[^\W\d]\w*(?:::\w+)*\z/s
ABCresult
0XX0
10X0
1100
1111
270 sub _CLASS ($) {
271 my $arg = shift;
272 (defined $arg and ! ref $arg and $arg =~ m/^[^\W\d]\w*(?:::\w+)*\z/s) ? $arg : undef;
273 }
274 END_PERL
275  
276 =pod
277  
278 =head2 _CLASSISA $string, $class
279  
280 The C<_CLASSISA> 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 string that is a particularly class, or a subclass of it.
283  
284 This function checks that the format is valid and calls the -E<gt>isa
285 method on the class name. It does not check that the class is actually
286 loaded.
287  
288 It also assumes "normalised" form, and does
289 not accept class names such as C<::Foo> or C<D'Oh>.
290  
291 Returns the string as a convenience if it is a valid class name, or
292 C<undef> if not.
293  
294 =cut
295  
296 52 ▶eval <<'END_PERL' unless defined &_CLASSISA;
Subroutine _CLASSISA: called CC=5 SCAR=16.1
Branch: 2 branches
BranchTrueFalseTotal
defined $string && !ref($string) && $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s && $string->isa($class) ? : 10 42 52
unless defined &Params::SomeUtil::_CLASSISA 19 0 19
Condition100%9/9
defined $string and not ref $string and $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s and $string->isa($class)
!ll&&!rl&&r
241810
defined $string and not ref $string and $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s
!ll&&!rl&&r
101428
defined $string and not ref $string
!ll&&!rl&&r
2842
MC/DC100%4/4
defined $string and not ref $string and $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s and $string->isa($class)
defined $string not ref $string $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s $string->isa($class)
Truth table100%5/5
A and not(B) and C and D
A= defined $stringB= not ref $stringC= $string =~ /^[^\W\d]\w*(?:::\w+)*\z/sD= $string->isa($class)
ABCDresult
0XXX0
10XX0
110X0
11100
11111
297 sub _CLASSISA ($$) {
298 my($string, $class) = @_;
299 (defined $string and ! ref $string and $string =~ m/^[^\W\d]\w*(?:::\w+)*\z/s and $string->isa($class)) ? $string : undef;
300 }
301 END_PERL
302  
303 =head2 _CLASSDOES $string, $role
304  
305 This routine behaves exactly like C<L</_CLASSISA>>, but checks with C<< ->DOES
306 >> rather than C<< ->isa >>. This is probably only a good idea to use on Perl
307 5.10 or later, when L<UNIVERSAL::DOES|UNIVERSAL::DOES/DOES> has been
308 implemented.
309  
310 =cut
311  
312 8 ▶eval <<'END_PERL' unless defined &_CLASSDOES;
Subroutine _CLASSDOES: called CC=5 SCAR=18.4
Branch: 2 branches
BranchTrueFalseTotal
defined $string && !ref($string) && $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s && $string->DOES($role) ? : 6 2 8
unless defined &Params::SomeUtil::_CLASSDOES 19 0 19
Condition44%4/9
defined $string and not ref $string and $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s and $string->DOES($role)
!ll&&!rl&&r
026
defined $string and not ref $string and $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s
!ll&&!rl&&r
008
defined $string and not ref $string
!ll&&!rl&&r
008
MC/DC25%1/4
defined $string and not ref $string and $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s and $string->DOES($role)
defined $string not ref $string $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s $string->DOES($role)
Truth table40%2/5
A and not(B) and C and D
A= defined $stringB= not ref $stringC= $string =~ /^[^\W\d]\w*(?:::\w+)*\z/sD= $string->DOES($role)
ABCDresult
0XXX0
10XX0
110X0
11100
11111
313 sub _CLASSDOES ($$) {
314 my($string, $role) = @_;
315 (defined $string and ! ref $string and $string =~ m/^[^\W\d]\w*(?:::\w+)*\z/s and $string->DOES($role)) ? $string : undef;
316 }
317 END_PERL
318  
319 =pod
320  
321 =head2 _SUBCLASS $string, $class
322  
323 The C<_SUBCLASS> function is intended to be imported into your
324 package, and provides a convenient way to test to see if a value is
325 a string that is a subclass of a specified class.
326  
327 This function checks that the format is valid and calls the -E<gt>isa
328 method on the class name. It does not check that the class is actually
329 loaded.
330  
331 It also assumes "normalised" form, and does
332 not accept class names such as C<::Foo> or C<D'Oh>.
333  
334 Returns the string as a convenience if it is a valid class name, or
335 C<undef> if not.
336  
337 =cut
338  
339 52 ▶eval <<'END_PERL' unless defined &_SUBCLASS;
Subroutine _SUBCLASS: called CC=6 SCAR=17.9
Branch: 2 branches
BranchTrueFalseTotal
defined $string && !ref($string) && $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s && $string ne $class && $string->isa($class) ? : 6 46 52
unless defined &Params::SomeUtil::_SUBCLASS 19 0 19
Condition100%12/12
defined $string and not ref $string and $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s and $string ne $class and $string->isa($class)
!ll&&!rl&&r
28186
defined $string and not ref $string and $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s and $string ne $class
!ll&&!rl&&r
24424
defined $string and not ref $string and $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s
!ll&&!rl&&r
101428
defined $string and not ref $string
!ll&&!rl&&r
2842
MC/DC100%5/5
defined $string and not ref $string and $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s and $string ne $class and $string->isa($class)
defined $string not ref $string $string =~ /^[^\W\d]\w*(?:::\w+)*\z/s $string ne $class $string->isa($class)
Truth table100%6/6
A and not(B) and C and D and E
A= defined $stringB= not ref $stringC= $string =~ /^[^\W\d]\w*(?:::\w+)*\z/sD= $string ne $classE= $string->isa($class)
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
340 sub _SUBCLASS ($$) {
341 my($string, $class) = @_;
342 (defined $string and ! ref $string and $string =~ m/^[^\W\d]\w*(?:::\w+)*\z/s and $string ne $class and $string->isa($class)) ? $string : undef;
343 }
344 END_PERL
345  
346 =pod
347  
348 =head2 _NUMBER $scalar
349  
350 The C<_NUMBER> function is intended to be imported into your
351 package, and provides a convenient way to test to see if a value is
352 a number. That is, it is defined and perl thinks it's a number.
353  
354 This function is basically a Params::SomeUtil-style wrapper around the
355 L<Scalar::Util> C<looks_like_number> function.
356  
357 Returns the value as a convenience, or C<undef> if the value is not a
358 number.
359  
360 =cut
361  
362 19 ▶eval <<'END_PERL' unless defined &_NUMBER;
Subroutine _NUMBER: called CC=4 SCAR=13.9
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Params::SomeUtil::_NUMBER 9 10 19
Condition100%3/3
defined $_[0] and not ref $_[0] and &looks_like_number($_[0])
!ll&&!rl&&r
832
MC/DC100%2/2
defined $_[0] and not ref $_[0] and &looks_like_number($_[0])
defined $_[0] and not ref $_[0] &looks_like_number($_[0])
Truth table100%3/3
A and B
A= defined $_[0] and not ref $_[0]B= &looks_like_number($_[0])
ABresult
0X0
100
111
363 sub _NUMBER ($) {
364 # Unlike _IDENTIFIER/_CLASS/_POSINT/etc (rt#81276), this does not
365 # copy $_[0] to a lexical first. Those needed the copy because a
366 # capture-less regex match against an aliased $1 clears $1 (and
367 # thus $_[0]) as a side effect. looks_like_number() is not a regex
368 # match, so $_[0] is safe to use directly here even when passed $1.
369 ( defined $_[0] and ! ref $_[0] and looks_like_number($_[0]) )
370 ? $_[0]
371 : undef;
372 }
373 END_PERL
374  
375 =pod
376  
377 =head2 _POSINT $integer
378  
379 The C<_POSINT> function is intended to be imported into your
380 package, and provides a convenient way to test to see if a value is
381 a positive integer (of any length).
382  
383 Returns the value as a convenience, or C<undef> if the value is not a
384 positive integer.
385  
386 The name itself is derived from the XML schema constraint of the same
387 name.
388  
389 =cut
390  
391 136 ▶eval <<'END_PERL' unless defined &_POSINT;
Subroutine _POSINT: called CC=4 SCAR=13.9
Branch: 2 branches
BranchTrueFalseTotal
defined $arg && !ref($arg) && $arg =~ /^[1-9]\d*$/ ? : 65 71 136
unless defined &Params::SomeUtil::_POSINT 19 0 19
Condition100%6/6
defined $arg and not ref $arg and $arg =~ /^[1-9]\d*$/
!ll&&!rl&&r
363565
defined $arg and not ref $arg
!ll&&!rl&&r
630100
MC/DC100%3/3
defined $arg and not ref $arg and $arg =~ /^[1-9]\d*$/
defined $arg not ref $arg $arg =~ /^[1-9]\d*$/
Truth table100%4/4
A and not(B) and C
A= defined $argB= not ref $argC= $arg =~ /^[1-9]\d*$/
ABCresult
0XX0
10X0
1100
1111
392 sub _POSINT ($) {
393 my $arg = shift;
394 (defined $arg and ! ref $arg and $arg =~ m/^[1-9]\d*$/) ? $arg : undef;
395 }
396 END_PERL
397  
398 =pod
399  
400 =head2 _NONNEGINT $integer
401  
402 The C<_NONNEGINT> function is intended to be imported into your
403 package, and provides a convenient way to test to see if a value is
404 a non-negative integer (of any length). That is, a positive integer,
405 or zero.
406  
407 Returns the value as a convenience, or C<undef> if the value is not a
408 non-negative integer.
409  
410 As with other tests that may return false values, care should be taken
411 to test via "defined" in valid boolean contexts.
412  
413 unless ( defined _NONNEGINT($value) ) {
414 die "Invalid value";
415 }
416  
417 The name itself is derived from the XML schema constraint of the same
418 name.
419  
420 =cut
421  
422 88 ▶eval <<'END_PERL' unless defined &_NONNEGINT;
Subroutine _NONNEGINT: called CC=4 SCAR=13.9
Branch: 2 branches
BranchTrueFalseTotal
defined $arg && !ref($arg) && $arg =~ /^(?:0|[1-9]\d*)$/ ? : 40 48 88
unless defined &Params::SomeUtil::_NONNEGINT 19 0 19
Condition100%6/6
defined $arg and not ref $arg and $arg =~ /^(?:0|[1-9]\d*)$/
!ll&&!rl&&r
242440
defined $arg and not ref $arg
!ll&&!rl&&r
42064
MC/DC100%3/3
defined $arg and not ref $arg and $arg =~ /^(?:0|[1-9]\d*)$/
defined $arg not ref $arg $arg =~ /^(?:0|[1-9]\d*)$/
Truth table100%4/4
A and not(B) and C
A= defined $argB= not ref $argC= $arg =~ /^(?:0|[1-9]\d*)$/
ABCresult
0XX0
10X0
1100
1111
423 sub _NONNEGINT ($) {
424 my $arg = shift;
425 (defined $arg and ! ref $arg and $arg =~ m/^(?:0|[1-9]\d*)$/) ? $arg : undef;
426 }
427 END_PERL
428  
429 =pod
430  
431 =head2 _SCALAR \$scalar
432  
433 The C<_SCALAR> function is intended to be imported into your package,
434 and provides a convenient way to test for a raw and unblessed
435 C<SCALAR> reference, with content of non-zero length.
436  
437 For a version that allows zero length C<SCALAR> references, see
438 the C<_SCALAR0> function.
439  
440 Returns the C<SCALAR> reference itself as a convenience, or C<undef>
441 if the value provided is not a C<SCALAR> reference.
442  
443 =cut
444  
445 19 ▶eval <<'END_PERL' unless defined &_SCALAR;
Subroutine _SCALAR: called CC=4 SCAR=13.9
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Params::SomeUtil::_SCALAR 9 10 19
446 sub _SCALAR ($) {
447 (ref $_[0] eq 'SCALAR' and defined ${$_[0]} and ${$_[0]} ne '') ? $_[0] : undef;
448 }
449 END_PERL
450  
451 =pod
452  
453 =head2 _SCALAR0 \$scalar
454  
455 The C<_SCALAR0> function is intended to be imported into your package,
456 and provides a convenient way to test for a raw and unblessed
457 C<SCALAR0> reference, allowing content of zero-length.
458  
459 For a simpler "give me some content" version that requires non-zero
460 length, C<_SCALAR> function.
461  
462 Returns the C<SCALAR> reference itself as a convenience, or C<undef>
463 if the value provided is not a C<SCALAR> reference.
464  
465 =cut
466  
467 19 ▶eval <<'END_PERL' unless defined &_SCALAR0;
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Params::SomeUtil::_SCALAR0 9 10 19
468 sub _SCALAR0 ($) {
469 ref $_[0] eq 'SCALAR' ? $_[0] : undef;
470 }
471 END_PERL
472  
473 =pod
474  
475 =head2 _ARRAY $value
476  
477 The C<_ARRAY> function is intended to be imported into your package,
478 and provides a convenient way to test for a raw and unblessed
479 C<ARRAY> reference containing B<at least> one element of any kind.
480  
481 For a more basic form that allows zero length ARRAY references, see
482 the C<_ARRAY0> function.
483  
484 Returns the C<ARRAY> reference itself as a convenience, or C<undef>
485 if the value provided is not an C<ARRAY> reference.
486  
487 =cut
488  
489 19 ▶eval <<'END_PERL' unless defined &_ARRAY;
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Params::SomeUtil::_ARRAY 9 10 19
490 sub _ARRAY ($) {
491 (ref $_[0] eq 'ARRAY' and @{$_[0]}) ? $_[0] : undef;
492 }
493 END_PERL
494  
495 =pod
496  
497 =head2 _ARRAY0 $value
498  
499 The C<_ARRAY0> function is intended to be imported into your package,
500 and provides a convenient way to test for a raw and unblessed
501 C<ARRAY> reference, allowing C<ARRAY> references that contain no
502 elements.
503  
504 For a more basic "An array of something" form that also requires at
505 least one element, see the C<_ARRAY> function.
506  
507 Returns the C<ARRAY> reference itself as a convenience, or C<undef>
508 if the value provided is not an C<ARRAY> reference.
509  
510 =cut
511  
512 19 ▶eval <<'END_PERL' unless defined &_ARRAY0;
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Params::SomeUtil::_ARRAY0 9 10 19
513 sub _ARRAY0 ($) {
514 ref $_[0] eq 'ARRAY' ? $_[0] : undef;
515 }
516 END_PERL
517  
518 =pod
519  
520 =head2 _ARRAYLIKE $value
521  
522 The C<_ARRAYLIKE> function tests whether a given scalar value can respond to
523 array dereferencing. If it can, the value is returned. If it cannot,
524 C<_ARRAYLIKE> returns C<undef>.
525  
526 =cut
527  
528 19 ▶eval <<'END_PERL' unless defined &_ARRAYLIKE;
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Params::SomeUtil::_ARRAYLIKE 9 10 19
529 sub _ARRAYLIKE {
530 (defined $_[0] and ref $_[0] and (
531 (Scalar::Util::reftype($_[0]) eq 'ARRAY')
532 or
533 overload::Method($_[0], '@{}')
534 )) ? $_[0] : undef;
535 }
536 END_PERL
537  
538 =pod
539  
540 =head2 _HASH $value
541  
542 The C<_HASH> function is intended to be imported into your package,
543 and provides a convenient way to test for a raw and unblessed
544 C<HASH> reference with at least one entry.
545  
546 For a version of this function that allows the C<HASH> to be empty,
547 see the C<_HASH0> function.
548  
549 Returns the C<HASH> reference itself as a convenience, or C<undef>
550 if the value provided is not an C<HASH> reference.
551  
552 =cut
553  
554 19 ▶eval <<'END_PERL' unless defined &_HASH;
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Params::SomeUtil::_HASH 9 10 19
555 sub _HASH ($) {
556 (ref $_[0] eq 'HASH' and scalar %{$_[0]}) ? $_[0] : undef;
557 }
558 END_PERL
559  
560 =pod
561  
562 =head2 _HASH0 $value
563  
564 The C<_HASH0> function is intended to be imported into your package,
565 and provides a convenient way to test for a raw and unblessed
566 C<HASH> reference, regardless of the C<HASH> content.
567  
568 For a simpler "A hash of something" version that requires at least one
569 element, see the C<_HASH> function.
570  
571 Returns the C<HASH> reference itself as a convenience, or C<undef>
572 if the value provided is not an C<HASH> reference.
573  
574 =cut
575  
576 19 ▶eval <<'END_PERL' unless defined &_HASH0;
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Params::SomeUtil::_HASH0 9 10 19
577 sub _HASH0 ($) {
578 ref $_[0] eq 'HASH' ? $_[0] : undef;
579 }
580 END_PERL
581  
582 =pod
583  
584 =head2 _HASHLIKE $value
585  
586 The C<_HASHLIKE> function tests whether a given scalar value can respond to
587 hash dereferencing. If it can, the value is returned. If it cannot,
588 C<_HASHLIKE> returns C<undef>.
589  
590 =cut
591  
592 19 ▶eval <<'END_PERL' unless defined &_HASHLIKE;
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Params::SomeUtil::_HASHLIKE 9 10 19
593 sub _HASHLIKE {
594 (defined $_[0] and ref $_[0] and (
595 (Scalar::Util::reftype($_[0]) eq 'HASH')
596 or
597 overload::Method($_[0], '%{}')
598 )) ? $_[0] : undef;
599 }
600 END_PERL
601  
602 =pod
603  
604 =head2 _CODE $value
605  
606 The C<_CODE> function is intended to be imported into your package,
607 and provides a convenient way to test for a raw and unblessed
608 C<CODE> reference.
609  
610 Returns the C<CODE> reference itself as a convenience, or C<undef>
611 if the value provided is not an C<CODE> reference.
612  
613 =cut
614  
615 19 ▶eval <<'END_PERL' unless defined &_CODE;
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Params::SomeUtil::_CODE 9 10 19
616 sub _CODE ($) {
617 ref $_[0] eq 'CODE' ? $_[0] : undef;
618 }
619 END_PERL
620  
621 =pod
622  
623 =head2 _CODELIKE $value
624  
625 The C<_CODELIKE> is the more generic version of C<_CODE>. Unlike C<_CODE>,
626 which checks for an explicit C<CODE> reference, the C<_CODELIKE> function
627 also includes things that act like them, such as blessed objects that
628 overload C<'&{}'>.
629  
630 Please note that in the case of objects overloaded with '&{}', you will
631 almost always end up also testing it in 'bool' context at some stage.
632  
633 For example:
634  
635 sub foo {
636 my $code1 = _CODELIKE(shift) or die "No code param provided";
637 my $code2 = _CODELIKE(shift);
638 if ( $code2 ) {
639 print "Got optional second code param";
640 }
641 }
642  
643 As such, you will most likely always want to make sure your class has
644 at least the following to allow it to evaluate to true in boolean
645 context.
646  
647 # Always evaluate to true in boolean context
648 use overload 'bool' => sub () { 1 };
649  
650 Returns the callable value as a convenience, or C<undef> if the
651 value provided is not callable.
652  
653 Note - This function was formerly known as _CALLABLE but has been renamed
654 for greater symmetry with the other _XXXXLIKE functions.
655  
656 The use of _CALLABLE has been deprecated. It will continue to work, but
657 with a warning, until end-2006, then will be removed.
658  
659 I apologise for any inconvenience caused.
660  
661 =cut
662  
663 19 ▶eval <<'END_PERL' unless defined &_CODELIKE;
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Params::SomeUtil::_CODELIKE 9 10 19
664 sub _CODELIKE($) {
665 (
666 (Scalar::Util::reftype($_[0])||'') eq 'CODE'
667 or
668 Scalar::Util::blessed($_[0]) and overload::Method($_[0],'&{}')
669 )
670 ? $_[0] : undef;
671 }
672 END_PERL
673  
674 =pod
675  
676 =head2 _INVOCANT $value
677  
678 This routine tests whether the given value is a valid method invocant.
679 This can be either an instance of an object, or a class name.
680  
681 If so, the value itself is returned. Otherwise, C<_INVOCANT>
682 returns C<undef>.
683  
684 =cut
685  
686 44 ▶eval <<'END_PERL' unless defined &_INVOCANT;
Subroutine _INVOCANT: called CC=4 SCAR=13.9
Branch: 2 branches
BranchTrueFalseTotal
defined $_[0] && (defined builtin::blessed($_[0]) || &_CLASS($_[0])) ? : 18 26 44
unless defined &Params::SomeUtil::_INVOCANT 19 0 19
Condition100%6/6
defined $_[0] and defined builtin::blessed($_[0]) || &_CLASS($_[0])
!ll&&!rl&&r
18818
defined builtin::blessed($_[0]) or &_CLASS($_[0])
l!l&&r!l&&!r
22614
MC/DC100%3/3
defined $_[0] and defined builtin::blessed($_[0]) || &_CLASS($_[0])
defined $_[0] defined builtin::blessed($_[0]) &_CLASS($_[0])
Truth table100%4/4
A and B or C
A= defined $_[0]B= defined builtin::blessed($_[0])C= &_CLASS($_[0])
ABCresult
0XX0
1000
11X1
1011
687 sub _INVOCANT($) {
688 (defined $_[0] and
689 (defined Scalar::Util::blessed($_[0])
690 or
691 # We used to check for stash definedness, but any class-like name is a
692 # valid invocant for UNIVERSAL methods, so we stopped. -- rjbs, 2006-07-02
693 Params::SomeUtil::_CLASS($_[0]))
694 ) ? $_[0] : undef;
695 }
696 END_PERL
697  
698 =pod
699  
700 =head2 _INSTANCE $object, $class
701  
702 The C<_INSTANCE> function is intended to be imported into your package,
703 and provides a convenient way to test for an object of a particular class
704 in a strictly correct manner.
705  
706 Returns the object itself as a convenience, or C<undef> if the value
707 provided is not an object of that type.
708  
709 =cut
710  
711 19 ▶eval <<'END_PERL' unless defined &_INSTANCE;
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Params::SomeUtil::_INSTANCE 9 10 19
712 sub _INSTANCE ($$) {
713 (Scalar::Util::blessed($_[0]) and $_[0]->isa($_[1])) ? $_[0] : undef;
714 }
715 END_PERL
716  
717 =head2 _INSTANCEDOES $object, $role
718  
719 This routine behaves exactly like C<L</_INSTANCE>>, but checks with C<< ->DOES
720 >> rather than C<< ->isa >>. This is probably only a good idea to use on Perl
721 5.10 or later, when L<UNIVERSAL::DOES|UNIVERSAL::DOES/DOES> has been
722 implemented.
723  
724 =cut
725  
726 117 ▶eval <<'END_PERL' unless defined &_INSTANCEDOES;
Subroutine _INSTANCEDOES: called CC=3 SCAR=11.0
Branch: 2 branches
BranchTrueFalseTotal
builtin::blessed($_[0]) && $_[0]->DOES($_[1]) ? : 90 45 135
unless defined &Params::SomeUtil::_INSTANCEDOES 19 0 19
Condition100%3/3
builtin::blessed($_[0]) and $_[0]->DOES($_[1])
!ll&&!rl&&r
521390
MC/DC100%2/2
builtin::blessed($_[0]) and $_[0]->DOES($_[1])
builtin::blessed($_[0]) $_[0]->DOES($_[1])
Truth table100%3/3
A and B
A= builtin::blessed($_[0])B= $_[0]->DOES($_[1])
ABresult
0X0
100
111
727 sub _INSTANCEDOES ($$) {
728 (Scalar::Util::blessed($_[0]) and $_[0]->DOES($_[1])) ? $_[0] : undef;
729 }
730 END_PERL
731  
732 =pod
733  
734 =head2 _REGEX $value
735  
736 The C<_REGEX> function is intended to be imported into your package,
737 and provides a convenient way to test for a regular expression.
738  
739 Returns the value itself as a convenience, or C<undef> if the value
740 provided is not a regular expression.
741  
742 =cut
743  
744 19 ▶eval <<'END_PERL' unless defined &_REGEX;
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Params::SomeUtil::_REGEX 9 10 19
745 sub _REGEX ($) {
746 (defined $_[0] and 'Regexp' eq ref($_[0])) ? $_[0] : undef;
747 }
748 END_PERL
749  
750 =pod
751  
752 =head2 _SET \@array, $class
753  
754 The C<_SET> function is intended to be imported into your package,
755 and provides a convenient way to test for set of at least one object of
756 a particular class in a strictly correct manner.
757  
758 The set is provided as a reference to an C<ARRAY> of objects of the
759 class provided.
760  
761 For an alternative function that allows zero-length sets, see the
762 C<_SET0> function.
763  
764 Returns the C<ARRAY> reference itself as a convenience, or C<undef> if
765 the value provided is not a set of that class.
766  
767 =cut
768  
769 74 ▶eval <<'END_PERL' unless defined &_SET;
Subroutine _SET: called CC=4 SCAR=13.9
Branch: 3 branches
BranchTrueFalseTotal
&_ARRAY($set) or return undef 30 84 114
&_INSTANCE($item, $_[0]) or return undef 22 38 60
unless defined &Params::SomeUtil::_SET 19 0 19
770 sub _SET ($$) {
771 my $set = shift;
772 _ARRAY($set) or return undef;
773 foreach my $item ( @$set ) {
774 _INSTANCE($item,$_[0]) or return undef;
775 }
776 $set;
777 }
778 END_PERL
779  
780 =pod
781  
782 =head2 _SET0 \@array, $class
783  
784 The C<_SET0> function is intended to be imported into your package,
785 and provides a convenient way to test for a set of objects of a
786 particular class in a strictly correct manner, allowing for zero objects.
787  
788 The set is provided as a reference to an C<ARRAY> of objects of the
789 class provided.
790  
791 For an alternative function that requires at least one object, see the
792 C<_SET> function.
793  
794 Returns the C<ARRAY> reference itself as a convenience, or C<undef> if
795 the value provided is not a set of that class.
796  
797 =cut
798  
799 80 ▶eval <<'END_PERL' unless defined &_SET0;
Subroutine _SET0: called CC=4 SCAR=13.9
Branch: 3 branches
BranchTrueFalseTotal
&_ARRAY0($set) or return undef 40 40 80
&_INSTANCE($item, $_[0]) or return undef 10 26 36
unless defined &Params::SomeUtil::_SET0 19 0 19
800 sub _SET0 ($$) {
801 my $set = shift;
802 _ARRAY0($set) or return undef;
803 foreach my $item ( @$set ) {
804 _INSTANCE($item,$_[0]) or return undef;
805 }
806 $set;
807 }
808 END_PERL
809  
810 =pod
811  
812 =head2 _HANDLE
813  
814 The C<_HANDLE> function is intended to be imported into your package,
815 and provides a convenient way to test whether or not a single scalar
816 value is a file handle.
817  
818 Unfortunately, in Perl the definition of a file handle can be a little
819 bit fuzzy, so this function is likely to be somewhat imperfect (at first
820 anyway).
821  
822 That said, it is implement as well or better than the other file handle
823 detectors in existence (and we stole from the best of them).
824  
825 =cut
826  
827 # We're doing this longhand for now. Once everything is perfect,
828 # we'll compress this into something that compiles more efficiently.
829 # Further, testing file handles is not something that is generally
830 # done millions of times, so doing it slowly is not a big speed hit.
831 0 ▶eval <<'END_PERL' unless defined &_HANDLE;
Subroutine _HANDLE: called CC=10 SCAR=24.5
Branch: 9 branches
BranchTrueFalseTotal
unless (defined $it) 10 44 54
if (ref $it eq "GLOB") 30 34 64
if (tied $it and tied($it)->can("TIEHANDLE")) 10 36 46
unless (builtin::blessed($it)) 26 13 39
if ($it->isa("IO::Handle")) 0 2 2
if ($it->isa("Tie::Handle")) 0 2 2
if ($it->isa("IO::Scalar")) 0 2 2
if ($it->isa("IO::String")) 0 2 2
unless defined &Params::SomeUtil::_HANDLE 19 0 19
Condition100%3/3
tied $it and tied($it)->can("TIEHANDLE")
!ll&&!rl&&r
302228
MC/DC100%2/2
tied $it and tied($it)->can("TIEHANDLE")
tied $it tied($it)->can("TIEHANDLE")
Truth table100%3/3
A and B
A= tied $itB= tied($it)->can("TIEHANDLE")
ABresult
0X0
100
111
832 sub _HANDLE {
833 my $it = shift;
834  
835 # It has to be defined, of course
836 unless ( defined $it ) {
837 return undef;
838 }
839  
840 # Normal globs are considered to be file handles
841 if ( ref $it eq 'GLOB' ) {
842 return $it;
843 }
844  
845 # Check for a normal tied filehandle
846 # Side Note: 5.5.4's tied() and can() doesn't like getting undef
847 if ( tied($it) and tied($it)->can('TIEHANDLE') ) {
848 return $it;
849 }
850  
851 # There are no other non-object handles that we support
852 unless ( Scalar::Util::blessed($it) ) {
853 return undef;
854 }
855  
856 # Check for a common base classes for conventional IO::Handle object
857 if ( $it->isa('IO::Handle') ) {
858 return $it;
859 }
860  
861  
862 # Check for tied file handles using Tie::Handle
863 if ( $it->isa('Tie::Handle') ) {
864 return $it;
865 }
866  
867 # IO::Scalar is not a proper seekable, but it is valid is a
868 # regular file handle
869 if ( $it->isa('IO::Scalar') ) {
870 return $it;
871 }
872  
873 # Yet another special case for IO::String, which refuses (for now
874 # anyway) to become a subclass of IO::Handle.
875 if ( $it->isa('IO::String') ) {
876 return $it;
877 }
878  
879 # This is not any sort of object we know about
880 return undef;
881 }
882 END_PERL
883  
884 =pod
885  
886 =head2 _DRIVER $string
887  
888 sub foo {
889 my $class = _DRIVER(shift, 'My::Driver::Base') or die "Bad driver";
890 ...
891 }
892  
893 The C<_DRIVER> function is intended to be imported into your
894 package, and provides a convenient way to load and validate
895 a driver class.
896  
897 The most common pattern when taking a driver class as a parameter
898 is to check that the name is a class (i.e. check against _CLASS)
899 and then to load the class (if it exists) and then ensure that
900 the class returns true for the isa method on some base driver name.
901  
902 Return the value as a convenience, or C<undef> if the value is not
903 a class name, the module does not exist, the module does not load,
904 or the class fails the isa test.
905  
906 =cut
907  
908 38 ▶eval <<'END_PERL' unless defined &_DRIVER;
Subroutine _DRIVER: called CC=6 SCAR=17.9
Branch: 2 branches
BranchTrueFalseTotal
defined &_CLASS($_[0]) && eval "require $_[0];" && !$@ && $_[0]->isa($_[1]) && $_[0] ne $_[1] ? : 4 34 38
unless defined &Params::SomeUtil::_DRIVER 19 0 19
Condition100%12/12
defined &_CLASS($_[0]) and eval "require $_[0];" and not $@ and $_[0]->isa($_[1]) and $_[0] ne $_[1]
!ll&&!rl&&r
34634
defined &_CLASS($_[0]) and eval "require $_[0];" and not $@ and $_[0]->isa($_[1])
!ll&&!rl&&r
401612
defined &_CLASS($_[0]) and eval "require $_[0];" and not $@
!ll&&!rl&&r
44810
defined &_CLASS($_[0]) and eval "require $_[0];"
!ll&&!rl&&r
301034
MC/DC80%4/5
defined &_CLASS($_[0]) and eval "require $_[0];" and not $@ and $_[0]->isa($_[1]) and $_[0] ne $_[1]
defined &_CLASS($_[0]) eval "require $_[0];" not $@ $_[0]->isa($_[1]) $_[0] ne $_[1]
Truth table83%5/6
A and B and not(C) and D and E
A= defined &_CLASS($_[0])B= eval "require $_[0];"C= not $@D= $_[0]->isa($_[1])E= $_[0] ne $_[1]
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
909 sub _DRIVER ($$) {
910 (defined _CLASS($_[0]) and eval "require $_[0];" and ! $@ and $_[0]->isa($_[1]) and $_[0] ne $_[1]) ? $_[0] : undef;
911 }
912 END_PERL
913  
914 25 ▶sub _alt_hook {
Subroutine _alt_hook: called CC=2 SCAR=6.9
915 package
916 Params::Util;
917  
918 1 our @EXPORT_OK = @Params::SomeUtil::EXPORT_OK;
919 1 our @ISA = @Params::SomeUtil::ISA;
920 1 our %EXPORT_TAGS = %Params::SomeUtil::EXPORT_TAGS;
921 1 our $VERSION = 1.07;
922  
923 1 foreach my $sub (@EXPORT_OK) {
924 19 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
925 27 *{$sub} = \&{"Params::SomeUtil::$sub"};
926 }
927 }
928  
929 19 1;
930  
931 =pod
932  
933 =head1 TO DO
934  
935 - Add _CAN to help resolve the UNIVERSAL::can debacle
936  
937 - Implement an assertion-like version of this module, that dies on
938 error.
939  
940 - Implement a Test:: version of this module, for use in testing
941  
942 =head1 SUPPORT
943  
944 Bugs should be reported on the GitHub for this repository
945  
946 L<https://github.com/uperl/Params-SomeUtil/issues>
947  
948 For other issues, contact the author.
949  
950 =head1 AUTHOR
951  
952 Adam Kennedy E<lt>adamk@cpan.orgE<gt>
953  
954 Maintained by
955  
956 Graham Ollis (PLICEASE)
957  
958 Contributors
959  
960 Paul Cochrane (PTC)
961  
962 Ricardo Signes (RGBS)
963  
964 RAFL
965  
966 Andrew Main (ZEFRAM)
967  
968 David Golden (DAGOLDEN)
969  
970 Tatsuhiko Miyagawa (MIYAGAWA)
971  
972 Peter Rabbitson (RIBASUSHI)
973  
974 =head1 SEE ALSO
975  
976 L<Params::Validate>
977  
978 =head1 COPYRIGHT
979  
980 Copyright 2005 - 2012 Adam Kennedy.
981 Copyright 2026 Graham Ollis.
982  
983 This program is free software; you can redistribute
984 it and/or modify it under the same terms as Perl itself.
985  
986 The full text of the license can be found in the
987 LICENSE file included with this module.
988  
989 =cut
↑ Summary SomeUtil.xs »