File Coverage

blib/lib/Util/Any.pm
Criterion Covered Total %
statement 335 341 98.2
branch 158 186 84.9
condition 72 87 82.7
subroutine 40 40 100.0
pod n/a
total 605 654 92.5


line stmt bran cond sub pod time code
1             package Util::Any;
2              
3 57     57   18943474 use ExportTo ();
  57         65868  
  57         1121  
4 57     57   33810 use Clone ();
  57         349449  
  57         1384  
5 57     57   404 use Carp ();
  57         123  
  57         909  
6 57     57   275 use warnings;
  57         98  
  57         2141  
7 57     57   266 use strict;
  57         109  
  57         155660  
8              
9             our $Utils = {
10             list => [ qw/List::Util List::MoreUtils List::Pairwise/ ],
11             data => [ qw/Scalar::Util/ ],
12             hash => [ qw/Hash::Util/ ],
13             debug => [ ['Data::Dumper', '', ['Dumper']] ],
14             string => [ qw/String::Util String::CamelCase/ ],
15             };
16              
17             $Utils->{'scalar'} = $Utils->{data};
18             # I'll delete no dash group in the above, in future.
19             $Utils->{'-' . $_} = $Utils->{$_} foreach keys %$Utils;
20              
21             our $SubExporterImport = 'do_import';
22              
23 87     87   713 sub _default_kinds { }
24              
25             # borrow from List::MoreUtils
26             sub _any (&@) {
27 92     92   277 my $f = shift;
28 92 100       369 return if ! @_;
29 75         204 for (@_) {
30 124 100       280 return 1 if $f->();
31             }
32 37         191 return 0;
33             }
34              
35             sub _uniq (@) {
36 306     306   357 my %h;
37 306 100       621 map { $h{$_}++ == 0 ? $_ : () } @_;
  3781         12447  
38             }
39             # /end
40              
41             sub import {
42 124     124   113416 my ($pkg, $caller) = (shift, (caller)[0]);
43 124 100 100     1603 return $pkg->_base_import($caller, @_) if @_ and $_[0] =~/^-[A-Z]\w+$/o;
44              
45 90         230 my %opt;
46 90 100 100     602 if (@_ > 1 and ref $_[-1] eq 'HASH') {
47 42         288 @opt{qw/prefix module_prefix debug smart_rename plugin/}
48 42         86 = (delete @{$_[-1]}{qw/prefix module_prefix debug smart_rename plugin/});
49 42 100       81 pop @_ unless %{$_[-1]};
  42         178  
50             }
51 90   100     2602 $opt{$_} ||= 0 foreach qw/prefix module_prefix debug smart_rename/;
52 90 100 66     398 if (not defined $opt{plugin}) {
    50          
53 82         187 $opt{plugin} = 'lazy';
54             } elsif ($opt{plugin} and $opt{plugin} ne 'eager') {
55 0         0 Carp::croak "wrong option is passed for plugin: " . $opt{plugin};
56             }
57              
58 90 100 100     580 @_ = %{$_[0]} if @_ == 1 and ref $_[0] eq 'HASH';
  7         38  
59              
60 57     57   395 my $config = Clone::clone(do { no strict 'refs'; ${$pkg . '::Utils'} });
  57         118  
  57         107325  
  90         158  
  90         126  
  90         6415  
61 90 100       1307 if ($pkg->can('_plugins')) {
62 13 100       37 if ($opt{plugin} eq 'eager') {
63 4         18 foreach my $plugin ($pkg->plugins) {
64 12         6541 eval "require $plugin";
65 12         188 my $util = $plugin->utils;
66 12         132 foreach my $kind (keys %$util) {
67 16   100     15 push @{$config->{$kind} ||= []}, @{$util->{$kind}};
  16         120  
  16         67  
68             }
69             }
70             }
71             }
72 90 100       1159 my ($arg, $want_kind) = $pkg->_arrange_args
    100          
73             ([
74             @_ ? ($_[0] =~m{^[-:]?all$}i ? ($_[0], $pkg->_default_kinds, @_[1 .. $#_]) : ($pkg->_default_kinds, @_))
75             : ($pkg->_default_kinds)
76             ],
77             $config, $caller, \%opt);
78 90         471 foreach my $kind (keys %$want_kind) {
79             # Carp::croak "$pkg doesn't have such kind of functions : $kind"
80             # unless exists $config->{$kind};
81 249         53236 $pkg->_kind_exporter($caller, $config->{$kind}, (lc(join "", $kind =~m{(\w+)}go)), $want_kind->{$kind}, \%opt);
82             }
83             }
84              
85             sub _kind_exporter {
86 249     249   659 my ($pkg, $caller, $kind_config, $kind_word, $import_setting, $opt) = @_;
87 249         862 my ($wanted_funcs, $local_definition, $kind_prefix, $kind_args) = $pkg->_func_definitions($import_setting);
88 249         708 my ($prefix, %exported, %class_func);
89              
90 249         488 foreach my $class_config (@$kind_config) { # $class_config is class name or array ref
91 393 100       1169 my ($class, $module_prefix, $config_options) = ref $class_config ? @$class_config : ($class_config, '', '');
92              
93 393         553 my $evalerror = '';
94 393 100       683 if ($evalerror = do { local $@; eval {my $path = $class; $path =~s{::}{/}go; require $path. ".pm"; $evalerror = $@ }; $@}) {
  393         491  
  393         593  
  393         545  
  393         1298  
  393         123293  
  391         332262  
  393         1460  
95             # if ($evalerror = do { local $@; eval "require $class"; $evalerror = $@ }) {
96 2 100       2004 $opt->{debug} == 2 ? Carp::croak $evalerror : Carp::carp $evalerror;
97             }
98              
99 392 100 66     2498 $prefix = $kind_prefix ? $kind_prefix :
    100          
    100          
    100          
100             ($opt->{module_prefix} and $module_prefix) ? $module_prefix :
101             $opt->{prefix} ? lc($kind_word) . '_' :
102             $opt->{smart_rename} ? $pkg->_create_smart_rename($kind_word) : '';
103              
104 392         505 my (@funcs, %rename);
105 392 100       2064 if (ref $config_options eq 'HASH') {
106             # -kind => {'first' => 'list_first', # first as list_first
107             # 'min' => \&build_min_reformatter,
108             # -select => ['first', 'sum', 'shuffle'] }
109              
110 66 100       318 if (exists $config_options->{-select}) {
    100          
    50          
111 34 50       2684 Carp::croak "cannot use -except & -select in same time." if exists $config_options->{-except};
112 34         54 @funcs = @{$config_options->{-select}}
  34         136  
113             } elsif (exists $config_options->{-except}) {
114 1         2 my %except;
115 1         2 @except{@{$config_options->{-except}}} = ();
  1         6  
116 1         2 @funcs = grep !exists $except{$_}, @{_all_funcs_in_class($class)};
  1         4  
117             } elsif (not @funcs) {
118 31         44 @funcs = @{_all_funcs_in_class($class)};
  31         76  
119             }
120 66 100       2353 foreach my $function (@$wanted_funcs ? (grep {defined $config_options->{$_}} @$wanted_funcs) : grep !/^-/, keys %$config_options) {
  29         80  
121 130 100       1255 if (ref(my $gen = $config_options->{$function}) eq 'CODE') {
  47 100       165  
122             # Like Sub::Exporter generator
123 83 100       190 if (exists $local_definition->{$function}) {
124 6         8 foreach my $def (@{$local_definition->{$function}}) {
  6         14  
125 10         208 my %arg;
126 10         77 $arg{$_} = $def->{$_} for grep !/^-/, keys %$def;
127 10   33     67 ExportTo::export_to($caller => {($def->{-as} || $function)
128             => $gen->($pkg, $class, $function, \%arg, $kind_args)});
129             }
130             } else {
131 77 100       143 if ($function ne '.') {
132 76         396 ExportTo::export_to($caller => {$prefix . $function => $gen->($pkg, $class, $function, {}, $kind_args)});
133             } else {
134 1         8 $gen->($pkg, $class, $function, {}, $kind_args);
135             }
136             }
137 83         9259 $exported{$function} = undef;
138             } elsif (defined &{$class . '::' . $function}) {
139 44         60 push @funcs, $function;
140 44         101 $rename{$function} = $config_options->{$function};
141             }
142             }
143             } else {
144 326 100       2326 @funcs = ref $config_options eq 'ARRAY' ? @$config_options : @{_all_funcs_in_class($class)};
  284         632  
145             }
146 392         2788 $class_func{$class} = [\@funcs, \%rename];
147             }
148 248         420 my %want_funcs;
149 248         5704 @want_funcs{@$wanted_funcs} = ();
150 248         601 foreach my $class (keys %class_func) {
151 387         33710 _do_export($caller, $class, $class_func{$class}->[0], \%want_funcs, \%exported,
152             $local_definition, $class_func{$class}->[1], $prefix, $kind_prefix);
153             }
154             }
155              
156             sub _do_export {
157 387     387   1079 my ($caller, $class, $funcs, $want_funcs, $exported, $local_definition, $rename, $prefix, $kind_prefix) = @_;
158 387         1214 my %reverse_rename = reverse %$rename;
159 387 100       1512 if (%$local_definition) {
    100          
160 29         74 foreach my $func (keys %$local_definition) {
161 40 100       226 next if exists $exported->{$func};
162 29 50 66     120 next if %$want_funcs and not exists $want_funcs->{$func};
163              
164 29         41 foreach my $def (@{$local_definition->{$func}}) {
  29         71  
165 29 50       72 if (ref $def eq 'HASH') {
166 29   50     104 my $local_rename = $def->{-as} || '';
167 29   66     244 my $original_func = $reverse_rename{$func} || $func;
168 57 100   57   471 if (do { no strict 'refs'; defined &{$class . '::' . $original_func} }) {
  57         124  
  57         10237  
  29         35  
  29         37  
  29         238  
169 15 0       56 my $function_name =
    0          
    50          
170             ($local_rename ? $local_rename :
171             $prefix ? (ref $prefix eq 'CODE' ? $prefix->($func) : $prefix . $func) : $func);
172 15         94 ExportTo::export_to($caller => {$function_name => $class . '::' . $original_func});
173             }
174             } else {
175 0 0       0 Carp::croak("setting for fucntions must be hash ref for : $func => "
176             . (ref $def eq 'ARRAY' ? "[". join(", ",@$def) ."]" : $def));
177             }
178             }
179             }
180             } elsif (@$funcs) {
181 57     57   308 no strict 'refs';
  57         142  
  57         2603112  
182 339         815 @$funcs = grep defined &{$class . '::'. $_}, @$funcs;
  5264         14028  
183 339 50       5410 return unless @$funcs;
184             }
185              
186 387         2787 my @export_funcs = grep !exists $local_definition->{$_}, @$funcs;
187 387 100       7533 @export_funcs = grep exists $want_funcs->{$_}, @export_funcs if %$want_funcs;
188 387 100 100     3210 if ($prefix or %$rename) {
189 102 100       241 if (ref $prefix eq 'CODE') {
190 1         3 ExportTo::export_to($caller => {map { $prefix->($_) => $class . '::' . $_} @export_funcs});
  3         8  
191             } else {
192 101   66     242 ExportTo::export_to($caller => {map { $prefix . ($rename->{$_} || $_) => $class . '::' . $_} @export_funcs});
  1267         5305  
193             }
194             } else {
195 285         892 ExportTo::export_to($caller => [map $class . '::' . $_, _uniq @export_funcs]);
196             }
197             }
198              
199             sub _create_smart_rename {
200 2     2   6 my ($pkg, $kind) = @_;
201             return sub {
202 9     9   20 my $str = shift;
203 9         15 my $prefix = '';
204 9 100       79 if ($str =~s{^(is_|has_|enable_|disable_|isnt_|have_|set_)}{}) {
205 4         17 $prefix = $1;
206             }
207 9 100 100     137 if ($str !~ m{^$kind} and $str !~ m{$kind$}) {
208 5         98 return $prefix . $kind . '_' . $str;
209             } else {
210 4         22 return $prefix . $str;
211             }
212 2         12 };
213             }
214              
215             {
216             my %tmp;
217             sub _all_funcs_in_class {
218 318     318   485 my ($class) = @_;
219 318 100       1900 return $tmp{$class} if exists $tmp{$class};
220 107         151 my %f;
221             {
222 57     57   381 no strict 'refs';
  57         132  
  57         17401  
  107         155  
223 107         154 @f{@{$class . '::EXPORT_OK'}, @{$class . '::EXPORT'}} = ();
  107         531  
  107         1920  
224             }
225 107         675 return $tmp{$class} = [grep defined &{$class . '::' . $_}, keys %f];
  1864         4986  
226             }
227             }
228              
229             sub _arrange_args {
230 95     95   18221 my ($pkg, $org_args, $config, $caller, $opt) = @_;
231 95         147 my (@arg, %want_kind);
232 95         400 my $import_module = $pkg->_use_import_module;
233 95         166 my $all_improt = 0;
234 95 100       605 if (@$org_args) {
235 92 50 33     2691 @$org_args = %{$org_args->[0]} if ref $org_args->[0] and (ref $org_args->[0]) eq 'HASH';
  0         0  
236 92   100     458 $opt->{'plugin'} ||= '';
237 92 100 100     1263 if ($org_args->[0] =~ /^([:-])?all/i) {
    100          
238 20         42 my $all_import = shift @$org_args;
239 20         80 my $inherit_all = $1;
240 20 100 100     481 $pkg->_lazy_load_plugins_all($config) if $opt->{'plugin'} eq 'lazy' and $pkg->can('_plugins');
241             # import all functions which Util::Any proxy
242 20         142 @want_kind{keys %$config} = ();
243 20 100 100     139 if ($inherit_all and $import_module) {
244 4 100 66     31 if ($import_module eq 'Exporter' or $import_module eq 'Exporter::Simple') {
    50          
    0          
245 57     57   2069 no strict 'refs'; no warnings;
  57     57   125  
  57         1650  
  57         288  
  57         119  
  57         1508999  
246 1 50       1 push @arg, ':all' if ${$pkg . '::EXPORT_TAGS'}{"all"};
  1         6  
247              
248             } elsif ($import_module eq 'Sub::Exporter') {
249 3         8 push @arg, '-all';
250             } elsif ($import_module eq 'Perl6::Export::Attrs') {
251 0         0 push @arg, ':ALL';
252             }
253             }
254             } elsif ($opt->{'plugin'} eq 'lazy' and $pkg->can('_plugins')) {
255 4         14 $pkg->_lazy_load_plugins($config, $org_args);
256             }
257 92 100   124   12222 if (_any {ref $_} @$org_args) {
  124         576  
258 38         146 for (my $i = 0; $i < @$org_args; $i++) {
259 57         97 my $kind = $org_args->[$i];
260 57         119 my $ref = ref $org_args->[$i + 1];
261 57 100       137 my $import_setting = $ref ? $org_args->[++$i] : undef;
262 57 100 100     265 if ($ref eq 'ARRAY' and !@$import_setting) {
263 2         4 $import_setting = [''];
264             }
265 57         172 _insert_want_arg($config, $kind, $import_setting, \%want_kind, \@arg);
266             }
267             } else {
268             # export specified kinds
269 54         153 foreach my $kind (@$org_args) {
270 45         176 _insert_want_arg($config, $kind, undef, \%want_kind, \@arg);
271             }
272             }
273             }
274 95 100       527 if ($import_module) {
275 11 100 100     101 $pkg->_do_base_import($import_module, $caller, \@arg) if @arg or !@$org_args;
276             } else {
277 84 100       1399 Carp::carp("unknown arguments: @arg") if @arg;
278             }
279 95         514 return \@arg, \%want_kind;
280             }
281              
282             sub _insert_want_arg {
283             # distinct arguments to want(for Util::Any) and args(for other).
284 102     102   345 my ($config, $kind, $import_setting, $want_kind, $arg) = @_;
285 102         210 $kind = lc $kind;
286 102 100       278 if (exists $config->{$kind}) {
287 88         578 $want_kind->{$kind} = $import_setting;
288             } else {
289 14 100       75 push @$arg, $kind, defined $import_setting ? $import_setting : ();
290             }
291             }
292              
293             sub _lazy_load_plugins_all {
294 1     1   3 my ($pkg, $config) = @_;
295 1         1 foreach my $plugin (@{$pkg->_plugins}) {
  1         5  
296 3         126 eval "require $plugin";
297 3 50       25 next if $@;
298 3         11 my $util = $plugin->utils;
299 3         33 foreach my $kind (keys %$util) {
300 4   100     6 push @{$config->{$kind} ||= []}, @{$util->{$kind}};
  4         16  
  4         17  
301             }
302             }
303             }
304              
305             sub _lazy_load_plugins {
306 4     4   8 my ($pkg, $config, $org_args) = @_;
307 4         5 my (@all, @kinds);
308 4         5 for my $i (0 .. $#{$org_args}) {
  4         15  
309 5 50       17 next if ref $org_args->[$i];
310 5         8 my $k = $org_args->[$i];
311 5         22 $k =~ s{\W+}{}g;
312 5         13 $k =~ s{_}{::}g;
313 5 100       24 $k =~ s{^(.+)::all$}{$1|$1::\\w+} and push @all, $i;
314 5         14 push @kinds, $k;
315             }
316 4 50       10 return unless @kinds;
317              
318 4         17 my $regex = "^${pkg}::Plugin::(?:". join("|", @kinds) . ')';
319 4         6 my $all_regex = '';
320 4 100       10 if (@all) {
321 1         7 $org_args->[$_] =~s{_all$}{} for @all;
322 1         4 $all_regex = "^${pkg}::Plugin::(?:".join("|", map {m{(\w+)}} @{$org_args}[@all]). ')';
  1         6  
  1         3  
323             }
324 4         5 foreach my $plugin (@{$pkg->_plugins}) {
  4         11  
325 12 100 100     285 if ($plugin =~m{$regex\W}i or $plugin =~m{$regex$}i) {
326 7         342 eval "require $plugin";
327 7 50       199 next if $@;
328 7         37 my $util = $plugin->utils;
329 7         77 foreach my $kind (keys %$util) {
330 9   100     12 push @{$config->{$kind} ||= []}, @{$util->{$kind}};
  9         38  
  9         14  
331 9 50 66     74 if ($all_regex and ($plugin =~ m{$all_regex\W}i or $plugin =~ m{$all_regex$}i)) {
      66        
332 2         14 push @$org_args, $kind;
333             }
334             }
335             }
336             }
337             }
338              
339             sub _func_definitions {
340 249     249   400 my ($pkg, $want_func_definition) = @_;
341 249         309 my ($kind_prefix, $kind_args, @wanted_funcs, %funcs, %local_definition);
342 249 100       1094 if (ref $want_func_definition eq 'HASH') {
    100          
343             # list => {func => {-as => 'rename'}}; list => {-prefix => 'hoge_' }
344 17 100       81 $kind_prefix = $want_func_definition->{-prefix}
345             if exists $want_func_definition->{-prefix};
346 17 50       53 $kind_args = $want_func_definition->{-args}
347             if exists $want_func_definition->{-args};
348 17         85 foreach my $f (grep !/^-/, keys %$want_func_definition) {
349 12         121 $local_definition{$f} = [$want_func_definition->{$f}];
350             }
351             } elsif (ref $want_func_definition eq 'ARRAY') {
352 21         69 foreach (my $i = 0; $i < @$want_func_definition; $i++) {
353 39         70 my ($k, $v) = @{$want_func_definition}[$i, $i + 1];
  39         78  
354 39 100       172 if ($k eq '-prefix') {
    100          
    100          
355 1         1 $kind_prefix = $v;
356 1         3 $i++;
357             } elsif ($k eq '-args') {
358 1         2 $kind_args = $v;
359 1         3 $i++;
360             }elsif (ref $v) {
361 13         16 $i++;
362 13         549 push @wanted_funcs, $k;
363 13   100     18 push @{$local_definition{$k} ||= []}, $v;
  13         1189  
364             } else {
365 24         168 push @wanted_funcs, $k;
366             }
367             }
368 21         59 @wanted_funcs = _uniq @wanted_funcs;
369             }
370 249   100     2814 return \@wanted_funcs, \%local_definition, $kind_prefix || '', $kind_args || {};
      100        
371             }
372              
373             sub _do_base_import {
374             # working with other modules like Expoter
375 10     10   25 my ($pkg, $import_module, $caller, $arg) = @_;
376 10         12 my $pkg_utils;
377             {
378 57     57   537 no strict 'refs';
  57         102  
  57         2322  
  10         26  
379 57     57   294 no warnings;
  57         125  
  57         8884  
380 10         13 $pkg_utils = ${$pkg . '::Utils'};
  10         32  
381             }
382 10 50       110 if ($import_module eq 'Perl6::Export::Attrs') {
    50          
    100          
    50          
383 0         0 eval "package $caller; $pkg" . '->Perl6::Export::Attrs::_generic_import(@$arg);';
384             } elsif ($import_module eq 'Exporter::Simple') {
385 0         0 eval "package $caller; $pkg" . '->Exporter::Simple::import(@$arg);';
386             } elsif ($import_module eq 'Exporter') {
387 4         278 eval "package $caller; $pkg" . '->Exporter::import(@$arg);';
388             } elsif ($import_module eq 'Sub::Exporter') {
389 57     57   842 no strict 'refs';
  57         105  
  57         3640  
390 57     57   283 no warnings;
  57         104  
  57         4243869  
391 6   66     19 my $import_name = ${"${pkg}::SubExporterImport"} || $Util::Any::SubExporterImport;
392 6         407 eval "package $caller; $pkg" . '->$import_name(@$arg);';
393             }
394 10 50       2553 die $@ if $@;
395             }
396              
397             sub _base_import {
398 42     42   16597 my ($pkg, $caller, @flgs) = @_;
399             {
400 57     57   348 no strict 'refs';
  57         141  
  57         4049  
  42         89  
401 42         72 push @{"${caller}::ISA"}, __PACKAGE__;
  42         733  
402             }
403 42         81 my @unknown;
404 42   66     584 while (@flgs and my $flg = lc shift @flgs) {
405 57     57   293 no strict 'refs';
  57         122  
  57         52855  
406 45 100       408 if ($flg eq '-perl6exportattrs') {
    100          
    100          
    100          
    100          
    100          
407 3         6 eval {require Perl6::Export::Attrs };
  3         1187  
408 3         24 *{$caller . '::MODIFY_CODE_ATTRIBUTES'} = \&Perl6::Export::Attrs::_generic_MCA;
  3         16  
409 3     1   14 *{$caller . '::_use_import_module'} = sub { 'Perl6::Export::Attrs' };
  3         22  
  1         7  
410             } elsif ($flg eq '-subexporter') {
411 8         17 eval { require Sub::Exporter };
  8         275903  
412 8     8   36167 *{$caller . '::_use_import_module'} = sub { 'Sub::Exporter' };
  8         66  
  8         742  
413             } elsif ($flg eq '-exportersimple') {
414 5         9 eval { require Exporter::Simple };
  5         3388  
415 5     1   36 *{$caller . '::_use_import_module'} = sub { 'Exporter::Simple' };
  5         45  
  1         6  
416             } elsif ($flg eq '-exporter') {
417 7         50 require Exporter;
418 7         15 push @{"${caller}::ISA"}, 'Exporter';
  7         88  
419 7     7   49 *{$caller . '::_use_import_module'} = sub { 'Exporter' };
  7         60  
  7         243  
420             } elsif ($flg eq '-base') {
421             # nothing to do
422             } elsif ($flg eq '-pluggable') {
423             # pluggable
424 3         83738 require Module::Pluggable;
425 3         58338 Module::Pluggable->import(require => 0, search_path => [$caller . '::Plugin'], inner => 0);
426 3         192 my @plugins = $pkg->plugins;
427 3     5   5954 *{$caller . '::_plugins'} = sub { \@plugins };
  3         41  
  5         23  
428             } else {
429 1         4 push @unknown, $flg;
430             }
431             }
432 42 100       4583 Carp::croak "cannot understand the option: @unknown" if @unknown;
433             }
434              
435 84     84   164 sub _use_import_module { 0 }
436              
437             =head1 NAME
438              
439             Util::Any - to export any utilities and to create your own utility module
440              
441             =cut
442              
443             our $VERSION = '0.24';
444              
445             =head1 SYNOPSIS
446              
447             use Util::Any -list;
448             # you can import any functions of List::Util and List::MoreUtils
449            
450             print uniq qw/1, 0, 1, 2, 3, 3/;
451              
452             If you want to choose functions
453              
454             use Util::Any -list => ['uniq'];
455             # you can import uniq function only, not import other functions
456            
457             print uniq qw/1, 0, 1, 2, 3, 3/;
458              
459             If you want to import All kind of utility functions
460              
461             use Util::Any -all;
462            
463             my $o = bless {};
464             my %hash = (a => 1, b => 2);
465            
466             # from Scalar::Util
467             blessed $o;
468            
469             # from Hash::Util
470             lock_keys %hash;
471              
472             If you want to import functions with prefix(ex. list_, scalar_, hash_)
473              
474             use Util::Any -all, {prefix => 1};
475             use Util::Any -list, {prefix => 1};
476             use Util::Any -list => ['uniq', 'min'], {prefix => 1};
477            
478             print list_uniq qw/1, 0, 1, 2, 3, 3/;
479            
480              
481             If you want to import functions with your own prefix.
482              
483             use Util::Any -list => {-prefix => "l_"};
484             print l_uniq qw/1, 0, 1, 2, 3, 3/;
485              
486             If you want to import functions as different name.
487              
488             use Util::Any -list => {uniq => {-as => 'listuniq'}};
489             print listuniq qw/1, 0, 1, 2, 3, 3/;
490              
491             When you use both renaming and your own prefix ?
492              
493             use Util::Any -list => {uniq => {-as => 'listuniq'}, -prefix => "l_"};
494             print listuniq qw/1, 0, 1, 2, 3, 3/;
495             print l_min qw/1, 0, 1, 2, 3, 3/;
496             # the following is NG
497             print l_uniq qw/1, 0, 1, 2, 3, 3/;
498              
499             =head1 DESCRIPTION
500              
501             For the people like the man who cannot remember C function is in whether List::Util or List::MoreUtils.
502             And for the newbie who don't know where useful utilities is.
503              
504             Perl has many modules and they have many utility functions.
505             For example, List::Util, List::MoreUtils, Scalar::Util, Hash::Util,
506             String::Util, String::CamelCase, Data::Dumper etc.
507              
508             We, Perl users, have to memorize modules name and their functions name.
509             Using this module, you don't need to memorize modules name,
510             only memorize kinds of modules and functions name.
511              
512             And this module allows you to create your own utility module, easily.
513             You can create your own module and use this in the same way as Util::Any like the following.
514              
515             use YourUtil -list;
516              
517             see C, in detail.
518              
519             =head1 HOW TO USE
520              
521             =head2 use Util::Any (KIND)
522              
523             use Util::Any -list, -hash;
524              
525             Give list of kinds of modules. All functions in modules are exported.
526              
527             =head2 use Util::Any KIND => [FUNCTIONS], ...;
528              
529             NOTE THAT kind '-all', 'all' or ':all' cannot take this option.
530              
531             use Util::Any -list => ['uniq'], -hash => ['lock_keys'];
532              
533             Give hash whose key is kind and value is function names as array ref.
534             Selected functions are exported.
535              
536             you can write it as hash ref.
537              
538             use Util::Any {-list => ['uniq'], -hash => ['lock_keys']};
539              
540             =head2 use Util::Any ..., {OPTION => VALUE};
541              
542             Util::Any can take last argument as option, which should be hash ref.
543              
544             =over 4
545              
546             =item prefix => 1
547              
548             add kind prefix to function name.
549              
550             use Util::Any -list, {prefix => 1};
551            
552             list_uniq(1,2,3,4,5); # it is List::More::Utils's uniq function
553              
554             =item module_prefix => 1
555              
556             see L.
557             Uti::Any itself doesn't have such a definition.
558              
559             =item smart_rename => 1
560              
561             see L.
562              
563             =item plugin => 'lazy' / 'eager' / 0 (default is 'lazy')
564              
565             If utility module based on Util::Any has plugin,
566             Its plugins are loaded when related kind is specified(if kind name matches module name).
567             If you want to load all plugin on using module, give 'eager' to this option.
568             If you don't want to use plugin, set 0.
569              
570             use Util::Yours -kind, .... {plugin => 'eager'}; # all plugins are loaded
571             use Util::Yours -kind, .... {plugin => 0}; # disable plugin feature.
572             use Util::Yours -kind; # is equal {plugin => 'lazy'}
573              
574             Relation of kind name and plugin name is the following.
575              
576             for example, If you have the following modules.
577              
578             Util::Yours::Plugin::Date
579             Util::Yours::Plugin::DateTime
580             Util::Yours::Plugin::Net
581             Util::Yours::Plugin::Net::Amazon
582             Util::Yours::Plugin::Net::Twitter
583              
584             the following code:
585              
586             use Util::Yours -date; # Plugin::Date is loaded
587             use Util::Yours -datetime; # Plugin::DateTime is loaded
588             use Util::Yours -net; # Plugin::Net is loaded
589             use Util::Yours -net_amazon; # Plugin::Net::Amazon is loaded
590             use Util::Yours -net_all; # Plugin::Net and Plugin::Net::* is loaded
591              
592             C<_all> is special keyword. see L<"NOTE ABOUT all KEYWORD">.
593              
594             =item debug => 1/2
595              
596             Util::Any doesn't say anything when loading module fails.
597             If you pass debug value, warn or die.
598              
599             use Util::Any -list, {debug => 1}; # warn
600             use Util::Any -list, {debug => 2}; # die
601              
602             =back
603              
604             =head1 EXPORT
605              
606             Kinds of functions and list of exported functions are below.
607             Note that these modules and version are on my environment(Perl 5.8.4).
608             So, it must be different on your environment.
609              
610             =head2 -data
611              
612             NOTE THAT: its old name is 'scalar' (you can use the name, yet).
613              
614             from Scalar::Util (1.19)
615              
616             blessed
617             dualvar
618             isvstring
619             isweak
620             looks_like_number
621             openhandle
622             readonly
623             refaddr
624             reftype
625             set_prototype
626             tainted
627             weaken
628              
629             =head2 -hash
630              
631             from Hash::Util (0.05)
632              
633             hash_seed
634             lock_hash
635             lock_keys
636             lock_value
637             unlock_hash
638             unlock_keys
639             unlock_value
640              
641             =head2 -list
642              
643             from List::Util (1.19)
644              
645             first
646             max
647             maxstr
648             min
649             minstr
650             reduce
651             shuffle
652             sum
653              
654             from List::MoreUtils (0.21)
655              
656             after
657             after_incl
658             all
659             any
660             apply
661             before
662             before_incl
663             each_array
664             each_arrayref
665             false
666             first_index
667             first_value
668             firstidx
669             firstval
670             indexes
671             insert_after
672             insert_after_string
673             last_index
674             last_value
675             lastidx
676             lastval
677             mesh
678             minmax
679             natatime
680             none
681             notall
682             pairwise
683             part
684             true
685             uniq
686             zip
687              
688             from List::Pairwise (0.29)
689              
690             mapp
691             grepp
692             firstp
693             lastp
694             map_pairwise
695             grep_pairwise
696             first_pairwise
697             last_pairwise
698             pair
699              
700             =head2 -string
701              
702             from String::Util (0.11)
703              
704             crunch
705             define
706             equndef
707             fullchomp
708             hascontent
709             htmlesc
710             neundef
711             nospace
712             randcrypt
713             randword
714             trim
715             unquote
716              
717             from String::CamelCase (0.01)
718              
719             camelize
720             decamelize
721             wordsplit
722              
723             =head2 -debug
724              
725             from Data::Dumper (2.121)
726              
727             Dumper
728              
729             =head1 EXPORTING LIKE Sub::Exporter
730              
731             Like Sub::Exporter, Util::Any can export function name as you like.
732              
733             use Util::Yours -list => {-prefix => 'list__', miin => {-as => "lmin"}};
734              
735             functions in -list, are exported with prefix "list__" except 'min' and 'min' is exported as C.
736              
737             =head1 PRIORITY OF THE WAYS TO CHANGE FUNCTION NAME
738              
739             There are some ways to change function name.
740             Their priority is the following.
741              
742             =over 4
743              
744             =item 1 rename
745              
746             -list => {uniq => {-as => 'luniq'}}
747              
748             =item 2 kind_prefix
749              
750             -list => {-prefix => list}
751              
752             =item 3 module_prefix
753              
754             Only if module's prefix is defined
755              
756             ..., {module_prefix => 1}
757              
758             =item 4 prefix
759              
760             ..., {prefix => 1}
761              
762             =item 5 smart_rename
763              
764             ..., {smart_rename => 1}
765              
766             =back
767              
768             I don't recommend to use 3, 4, 5 in same time, because it may confuse you.
769              
770             =over 4
771              
772             =item 3 + 4
773              
774             if module's prefix is defined in class(not defined in Util::Any), use 3, or use 4.
775              
776             =item 3 + 5
777              
778             3 or 5. reason is as same as the above.
779              
780             =item 3 + 4 + 5
781              
782             5 is ignored.
783              
784             =item 4 + 5
785              
786             5 is ignored.
787              
788             =back
789              
790             =head1 NOTE ABOUT all KEYWORD
791              
792             B is special keyword, so it has some restriction.
793              
794             =head2 use module with 'all' cannot take its arguments
795              
796             use Util::Any -all; # or 'all', ':all'
797              
798             This cannot take sequential arguments for "all". For example;
799              
800             NG: use Util::Any -all => ['shuffle'];
801              
802             When sequential arguments is kind's, it's ok.
803              
804             use Util::Any -all, -list => ['unique'];
805              
806             =head2 -plugin_module_all cannot take its arguments
807              
808             use Util::Yours -plugin_name_all;
809              
810             This cannot take sequential arguments for it. For example:
811              
812             NG: use Util::Yours -plugin_name_all => ['some_function'];
813              
814             =head1 CREATE YOUR OWN Util::Any
815              
816             Just inherit Util::Any and define $Utils hash ref as the following.
817              
818             package Util::Yours;
819            
820             use Clone qw/clone/;
821             use Util::Any -Base; # as same as use base qw/Util::Any/;
822             # If you don't want to inherit Util::Any setting, no need to clone.
823             our $Utils = clone $Util::Any::Utils;
824             push @{$Utils->{-list}}, qw/Your::Favorite::List::Utils/;
825            
826             1;
827              
828             In your code;
829              
830             use Util::Yours -list;
831              
832             =head2 $Utils STRUCTURE
833              
834             =head3 overview
835              
836             $Utils => {
837             # simply put module names
838             -kind1 => [qw/Module1 Module2 ..../],
839             -# Module name and its prefix
840             -kind2 => [ [Module1 => 'module_prefix'], ... ],
841             # limit functions to be exported
842             -kind3 => [ [Module1, 'module_prefix', [qw/func1 func2/] ], ... ],
843             # as same as above except not specify modul prefix
844             -kind4 => [ [Module1, '', [qw/func1 func2/] ], ... ],
845             };
846              
847             =head3 Key must be lower character.
848              
849             NG $Utils = { LIST => [qw/List::Util/]};
850             OK $Utils = { list => [qw/List::Util/]};
851             OK $Utils = { -list => [qw/List::Util/]};
852             OK $Utils = { ':list' => [qw/List::Util/]};
853              
854             =head3 C cannot be used for key.
855              
856             NG $Utils = { all => [qw/List::Util/]};
857             NG $Utils = { -all => [qw/List::Util/]};
858             NG $Utils = { ':all' => [qw/List::Util/]};
859              
860             =head3 Value is array ref which contained scalar or array ref.
861              
862             Scalar is module name. Array ref is module name and its prefix.
863              
864             $Utils = { list => ['List::Utils'] };
865             $Utils = { list => [['List::Utils', 'prefix_']] };
866              
867             see L
868              
869             =head2 PREFIX FOR EACH MODULE
870              
871             If you want to import many modules and they have same function name.
872             You can specify prefix for each module like the following.
873              
874             use base qw/Util::Any/;
875            
876             our $Utils = {
877             list => [['List::Util' => 'lu_'], ['List::MoreUtils' => 'lmu_']]
878             };
879              
880             In your code;
881              
882             use Util::Yours qw/list/, {module_prefix => 1};
883              
884             =head2 SMART RENAME FOR EACH KIND
885              
886             smart_rename option rename function name by a little smart way.
887             For example,
888              
889             our $Utils = {
890             utf8 => [['utf8', '',
891             {
892             is_utf8 => 'is_utf8',
893             upgrade => 'utf8_upgrade',
894             downgrade => 'downgrade',
895             }
896             ]],
897             };
898              
899             In this definition, use C 1> is not good idea. If you use it:
900              
901             is_utf8 => utf8_is_utf8
902             utf8_upgrade => utf8_utf8_upgrade
903             downgrade => utf8_downgrade
904              
905             That's too bad. If you use C 1> instead:
906              
907             is_utf8 => is_utf8
908             utf8_upgrade => utf8_upgrade
909             downgrade => utf8_downgrade
910              
911             rename rule is represented in _create_smart_rename in Util::Any.
912              
913             =head2 CHANGE smart_rename BEHAVIOUR
914              
915             To define _create_smart_rename, you can change smart_rename behaviour.
916             _create_smart_rename get 2 argument, package name and kind of utility,
917             and should return code reference which get function name and return new name.
918             As an example, see Util::Any's _create_smart_rename.
919              
920             =head2 OTHER WAY TO EXPORT FUNCTIONS
921              
922             =head3 SELECT FUNCTIONS
923              
924             Util::Any automatically export functions from modules' @EXPORT and @EXPORT_OK.
925             In some cases, it is not good idea like Data::Dumper's Dumper and C.
926             These 2 functions are same feature.
927              
928             So you can limit functions to be exported.
929              
930             our $Utils = {
931             -debug => [
932             ['Data::Dumper', '',
933             ['Dumper']], # only Dumper method is exported.
934             ],
935             };
936              
937             or
938              
939             our $Utils = {
940             -debug => [
941             ['Data::Dumper', '',
942             { -select => ['Dumper'] }, # only Dumper method is exported.
943             ]
944             ],
945             };
946              
947              
948             =head3 SELECT FUNCTIONS EXCEPT
949              
950             Inverse of -select option. Cannot use this option with -select.
951              
952             our $Utils = {
953             -debug => [
954             ['Data::Dumper', '',
955             { -except => ['DumperX'] }, # export functions except DumperX
956             ]
957             ],
958             };
959              
960             =head3 RENAME FUNCTIONS
961              
962             To rename function name, write original function name as hash key and renamed name as hash value.
963             this definition is prior to -select/-except.
964              
965             In the following example, 'min' is not in -select list, but can be exported.
966              
967             our $Utils = {
968             -list => [[
969             'List::Util', '',
970             {
971             'first' => 'list_first', # first as list_first
972             'sum' => 'lsum', # sum as lsum
973             'min' => 'lmin', # min as lmin
974             -select => ['first', 'sum', 'shuffle'],
975             }
976             ]]
977             };
978              
979             =head3 USE Sub::Exporter's GENERATOR WAY
980              
981             It's somewhat complicate, I just show you code.
982              
983             Your utility class:
984              
985             package SubExporterGenerator;
986            
987             use strict;
988             use Util::Any -Base;
989            
990             our $Utils =
991             {
992             -test => [[
993             'List::Util', '',
994             { min => \&build_min_reformatter,}
995             ]]
996             };
997            
998             sub build_min_reformatter {
999             my ($pkg, $class, $name, @option) = @_;
1000             no strict 'refs';
1001             my $code = do { no strict 'refs'; \&{$class . '::' . $name}};
1002             sub {
1003             my @args = @_;
1004             $code->(@args, $option[0]->{under} || ());
1005             }
1006             }
1007              
1008             Your script using your utility class:
1009              
1010             package main;
1011            
1012             use strict;
1013             use lib qw(lib t/lib);
1014             use SubExporterGenerator -test => [
1015             min => {-as => "min_under_20", under => 20},
1016             min => {-as => "min_under_5" , under => 5},
1017             ];
1018            
1019             print min_under_20(100,25,30); # 20
1020             print min_under_20(100,10,30); # 10
1021             print min_under_20(100,25,30); # 5
1022             print min_under_20(100,1,30); # 1
1023              
1024             If you don't specify C<-as>, exported function as C.
1025             But, of course, the following doesn't work.
1026              
1027             use SubExporterGenerator -test => [
1028             min => {under => 20},
1029             min => {under => 5},
1030             ];
1031              
1032             Util::Any try to export duplicate function C, one of both should fail.
1033              
1034             =head4 GIVE DEFAULT ARGUMENTS TO CODE GENERATOR
1035              
1036             You may want to give default arguments to all code generators in same kind.
1037             For example, if you create shortcut to use Number::Format,
1038             you may want to give common arguments with creating instance.
1039              
1040             -number => [
1041             [ 'Number::Format' => {
1042             'round' => sub {
1043             my($pkg, $class, $func, $args, $default_args) = @_;
1044             my $n = 'Number::Format'->new(%$default_args);
1045             sub { $n->round(@_); }
1046             },
1047             'number_format' => sub {
1048             my($pkg, $class, $func, $args, $default_args) = @_;
1049             my $n = 'Number::Format'->new(%$default_args, %$args);
1050             sub { $n->format_number(@_); }
1051             }
1052             }
1053             ];
1054              
1055             And write as the following:
1056              
1057             use Util::Yours -number => [-args => {thousands_sep => "_", int_curr_symbol => '\'} ];
1058            
1059             print number_format(100000); # 100_000
1060             print number_price(100000); # \100_000
1061              
1062             thousands_sep and int_curr_symbol are given to all of -number kind of function.
1063              
1064             =head2 DO SOMETHING WITHOUT EXPORTING ANYTHING
1065              
1066             -strict => [
1067             [ 'strict' => {
1068             '.' => sub {
1069             strict->import();
1070             warnings->import();
1071             },
1072             }
1073             ];
1074              
1075             This definition works like as pragma.
1076              
1077             use Util::Yours -strict;
1078              
1079             function name '.' is special. This name is not exported and only execute the code in the definition.
1080              
1081             =head2 ADD DEFAULT ARGUMENT FOR EXPORTING
1082              
1083             Define the following method.
1084              
1085             package You::Utils -Base;
1086             # ....
1087             sub _default_kinds { '-list', '-string' }
1088              
1089             This means '-list' and '-string' arguments are given as default exporting arguments.
1090             So, these are same.
1091              
1092             use Your::Utils;
1093              
1094             is equal to
1095              
1096             use Your::Utils -list, -string;
1097              
1098             If you want to disable default kinds.
1099              
1100             use Your::Utils -list => [], -string;
1101              
1102             =head2 ADD PLUGGABLE FEATURE FOR YOUR MODULE
1103              
1104             Just add a flag -Pluggbale.
1105              
1106             package Util::Yours;
1107             use Util::Any -Base, -Pluggable;
1108              
1109             And write plugin as the following:
1110              
1111             package Util::Yours::Plugin::Net;
1112            
1113             sub utils {
1114             # This structure is as same as $Utils.
1115             return {
1116             # kind name and plugin name should be same.
1117             -net => [
1118             [
1119             'Net::Amazon', '',
1120             {
1121             amazon => sub {
1122             my ($pkg, $class, $func, $args) = @_;
1123             my $amazon = Net::Amazon->new(token => $args->{token});
1124             sub { $amazon }
1125             },
1126             }
1127             ]
1128             ]
1129             };
1130             }
1131            
1132             1;
1133              
1134             And you can use it as the following.
1135              
1136             use Util::Yours -net => [amazon => {token => "your_token"}];
1137            
1138             my $amazon = amazon; # get Net::Amazon object;
1139              
1140             Util::Any can merge definition in plugins. If same kind is in several plugins, it works.
1141             But same kind and same function name is defined, one of them doesn't work.
1142              
1143             =head2 WORKING WITH EXPORTER-LIKE MODULES
1144              
1145             NOTE THAT: I don't recommend this usage, because using this may confuse user;
1146             some of import options are for Util::Any and others are for exporter-like module
1147             (especially, using with Sub::Exporter is confusing).
1148              
1149             CPAN has some modules to export functions.
1150             Util::Any can work with some of such modules, L, L, L and L.
1151             If you want to use other modules, please inform me or implement import method by yourself.
1152              
1153             If you want to use module mentioned above, you have to change the way to inherit these modules.
1154              
1155             =head3 DIFFERENCE between 'all' and '-all' or ':all'
1156              
1157             If your utility module which inherited Util::Any has utility functions and export them by Exporter-like module,
1158             behaviour of 'all' and '-all' or ':all' is a bit different.
1159              
1160             'all' ... export all utilities defined in your package's $Utils variables.
1161             '-all' or ':all' ... export all utilities including functions in your util module itself.
1162              
1163             =head3 ALTERNATIVE INHERITING
1164              
1165             Normally, you use;
1166              
1167             package YourUtils;
1168            
1169             use Util::Any -Base; # or "use base qw/Util::Any/;"
1170              
1171             But, if you want to use L, L or L.
1172             write as the following, instead.
1173              
1174             # if you want to use Exporter
1175             use Util::Any -Exporter;
1176             # if you want to use Exporter::Simple
1177             use Util::Any -ExporterSimple;
1178             # if you want to use Sub::Exporter
1179             use Util::Any -SubExporter;
1180             # if you want to use Perl6::Export::Attrs
1181             use Util::Any -Perl6ExportAttrs;
1182              
1183             That's all.
1184             Note that B.
1185              
1186             There is one notice to use Sub::Exporter.
1187              
1188             Sub::Exporter::setup_exporter
1189             ({
1190             as => 'do_import', # name is important
1191             exports => [...],
1192             groups => { ... },
1193             });
1194              
1195             You must pass "as" option to setup_exporter and its value must be "do_import".
1196             If you want to change this name, do the following.
1197              
1198             Sub::Exporter::setup_exporter
1199             ({
1200             as => $YourUtils::SubExporterImport = '__do_import',
1201             exports => [...],
1202             groups => { ... },
1203             });
1204              
1205             =head3 EXAMPLE to USE Perl6::Export::Attrs in YOUR OWN UTIL MODULE
1206              
1207             Perl6::Export::Attributes is not recommended in the following URL
1208             (http://www.perlfoundation.org/perl5/index.cgi?pbp_module_recommendation_commentary).
1209             So, you'd better use other exporter module. It is left as an example.
1210              
1211             package Util::Yours;
1212            
1213             use Clone qw/clone/;
1214             use Util::Any -Perl6ExportAttrs;
1215             our $Utils = clone $Util::Any::Utils;
1216             push @{$Utils->{list}}, qw/Your::Favorite::List::Utils/;
1217            
1218             sub foo :Export(:DEFAULT) {
1219             return "foo!";
1220             }
1221            
1222             sub bar :Export(:bar) {
1223             return "bar!";
1224             }
1225            
1226             1;
1227              
1228             =head2 IMPLEMENT IMPORT by YOURSELF
1229              
1230             Perl6::Export::Attributes is not recommended in the following URL
1231             (http://www.perlfoundation.org/perl5/index.cgi?pbp_module_recommendation_commentary).
1232             So, you'd better use other exporter module. It is left as an example.
1233              
1234             You can write your own import method and BEGIN block like the following.
1235             Instead of using "use Util::Any -Perl6ExportAttrs".
1236              
1237             package UtilPerl6ExportAttr;
1238            
1239             use strict;
1240             use base qw/Util::Any/;
1241             use Clone qw/clone/;
1242            
1243             BEGIN {
1244             use Perl6::Export::Attrs ();
1245             no strict 'refs';
1246             *{__PACKAGE__ . '::MODIFY_CODE_ATTRIBUTES'} = \&Perl6::Export::Attrs::_generic_MCA;
1247             }
1248            
1249             our $Utils = clone $Util::Any::Utils;
1250             $Utils->{your_list} = [
1251             ['List::Util', '', [qw(first min sum)]],
1252             ];
1253            
1254             sub import {
1255             my $pkg = shift;
1256             my $caller = (caller)[0];
1257            
1258             no strict 'refs';
1259             eval "package $caller; $pkg" . '->Util::Any::import(@_);';
1260             my @arg = grep !exists $Utils->{$_}, @_;
1261             if ((@_ and @arg) or !@_) {
1262             eval "package $caller; $pkg" . '->Perl6::Export::Attrs::_generic_import(@arg)';
1263             }
1264             return;
1265             }
1266            
1267             sub foo :Export(:DEFAULT) {
1268             return "foo!";
1269             }
1270            
1271             1;
1272              
1273             =head1 AUTHOR
1274              
1275             Ktat, C<< >>
1276              
1277             =head1 BUGS
1278              
1279             Please report any bugs or feature requests to
1280             C, or through the web interface at
1281             L.
1282             I will be notified, and then you'll automatically be notified of progress on
1283             your bug as I make changes.
1284              
1285             =head1 SUPPORT
1286              
1287             You can find documentation for this module with the perldoc command.
1288              
1289             perldoc Util::Any
1290              
1291             You can also look for information at:
1292              
1293             =over 4
1294              
1295             =item * AnnoCPAN: Annotated CPAN documentation
1296              
1297             L
1298              
1299             =item * CPAN Ratings
1300              
1301             L
1302              
1303             =item * RT: CPAN's request tracker
1304              
1305             L
1306              
1307             =item * Search CPAN
1308              
1309             L
1310              
1311             =back
1312              
1313             =head1 REPOSITORY
1314              
1315             svn co http://svn.coderepos.org/share/lang/perl/Util-Any/trunk Util-Any
1316              
1317             Subversion repository of Util::Any is hosted at http://coderepos.org/share/.
1318             patches and collaborators are welcome.
1319              
1320             =head1 SEE ALSO
1321              
1322             The following modules can work with Util::Any.
1323              
1324             L, L, L and L.
1325              
1326             The following is new module Util::All, based on Util::Any.
1327              
1328             http://github.com/ktat/Util-All
1329              
1330             =head1 ACKNOWLEDGEMENTS
1331              
1332             =head1 COPYRIGHT & LICENSE
1333              
1334             Copyright 2008-2010 Ktat, all rights reserved.
1335              
1336             This program is free software; you can redistribute it and/or modify it
1337             under the same terms as Perl itself.
1338              
1339             =cut
1340              
1341             1; # End of Util-Any