-
Notifications
You must be signed in to change notification settings - Fork 26
/
PP.pm
953 lines (816 loc) · 19.1 KB
/
PP.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
package List::MoreUtils::PP;
use 5.008_001;
use strict;
use warnings;
our $VERSION = '0.430';
=pod
=head1 NAME
List::MoreUtils::PP - Provide List::MoreUtils pure Perl implementation
=head1 SYNOPSIS
BEGIN { $ENV{LIST_MOREUTILS_PP} = 1; }
use List::MoreUtils qw(:all);
=cut
## no critic (Subroutines::ProhibitSubroutinePrototypes, Subroutines::RequireArgUnpacking)
## no critic (Subroutines::ProhibitManyArgs)
sub any (&@)
{
my $f = shift;
foreach (@_)
{
return 1 if $f->();
}
return 0;
}
sub all (&@)
{
my $f = shift;
foreach (@_)
{
return 0 unless $f->();
}
return 1;
}
sub none (&@)
{
my $f = shift;
foreach (@_)
{
return 0 if $f->();
}
return 1;
}
sub notall (&@)
{
my $f = shift;
foreach (@_)
{
return 1 unless $f->();
}
return 0;
}
sub one (&@)
{
my $f = shift;
my $found = 0;
foreach (@_)
{
$f->() and $found++ and return 0;
}
return $found;
}
sub any_u (&@)
{
my $f = shift;
return if !@_;
$f->() and return 1 foreach (@_);
return 0;
}
sub all_u (&@)
{
my $f = shift;
return if !@_;
$f->() or return 0 foreach (@_);
return 1;
}
sub none_u (&@)
{
my $f = shift;
return if !@_;
$f->() and return 0 foreach (@_);
return 1;
}
sub notall_u (&@)
{
my $f = shift;
return if !@_;
$f->() or return 1 foreach (@_);
return 0;
}
sub one_u (&@)
{
my $f = shift;
return if !@_;
my $found = 0;
foreach (@_)
{
$f->() and $found++ and return 0;
}
return $found;
}
sub reduce_u(&@)
{
my $code = shift;
# Localise $a, $b
my ($caller_a, $caller_b) = do
{
my $pkg = caller();
## no critic (TestingAndDebugging::ProhibitNoStrict, ValuesAndExpressions::ProhibitCommaSeparatedStatements)
no strict 'refs';
\*{$pkg . '::a'}, \*{$pkg . '::b'};
};
## no critic (Variables::RequireInitializationForLocalVars)
local (*$caller_a, *$caller_b);
*$caller_a = \();
for (0 .. $#_)
{
*$caller_b = \$_[$_];
*$caller_a = \($code->());
}
return ${*$caller_a};
}
sub reduce_0(&@)
{
my $code = shift;
# Localise $a, $b
my ($caller_a, $caller_b) = do
{
my $pkg = caller();
## no critic (TestingAndDebugging::ProhibitNoStrict, ValuesAndExpressions::ProhibitCommaSeparatedStatements)
no strict 'refs';
\*{$pkg . '::a'}, \*{$pkg . '::b'};
};
## no critic (Variables::RequireInitializationForLocalVars)
local (*$caller_a, *$caller_b);
*$caller_a = \0;
for (0 .. $#_)
{
*$caller_b = \$_[$_];
*$caller_a = \($code->());
}
return ${*$caller_a};
}
sub reduce_1(&@)
{
my $code = shift;
# Localise $a, $b
my ($caller_a, $caller_b) = do
{
my $pkg = caller();
## no critic (TestingAndDebugging::ProhibitNoStrict, ValuesAndExpressions::ProhibitCommaSeparatedStatements)
no strict 'refs';
\*{$pkg . '::a'}, \*{$pkg . '::b'};
};
## no critic (Variables::RequireInitializationForLocalVars)
local (*$caller_a, *$caller_b);
*$caller_a = \1;
for (0 .. $#_)
{
*$caller_b = \$_[$_];
*$caller_a = \($code->());
}
return ${*$caller_a};
}
sub true (&@)
{
my $f = shift;
my $count = 0;
$f->() and ++$count foreach (@_);
return $count;
}
sub false (&@)
{
my $f = shift;
my $count = 0;
$f->() or ++$count foreach (@_);
return $count;
}
sub firstidx (&@)
{
my $f = shift;
foreach my $i (0 .. $#_)
{
local *_ = \$_[$i];
return $i if $f->();
}
return -1;
}
sub firstval (&@)
{
my $test = shift;
foreach (@_)
{
return $_ if $test->();
}
## no critic (Subroutines::ProhibitExplicitReturnUndef)
return undef;
}
sub firstres (&@)
{
my $test = shift;
foreach (@_)
{
my $testval = $test->();
$testval and return $testval;
}
## no critic (Subroutines::ProhibitExplicitReturnUndef)
return undef;
}
sub onlyidx (&@)
{
my $f = shift;
my $found;
foreach my $i (0 .. $#_)
{
local *_ = \$_[$i];
$f->() or next;
defined $found and return -1;
$found = $i;
}
return defined $found ? $found : -1;
}
sub onlyval (&@)
{
my $test = shift;
my $result = undef;
my $found = 0;
foreach (@_)
{
$test->() or next;
$result = $_;
## no critic (Subroutines::ProhibitExplicitReturnUndef)
$found++ and return undef;
}
return $result;
}
sub onlyres (&@)
{
my $test = shift;
my $result = undef;
my $found = 0;
foreach (@_)
{
my $rv = $test->() or next;
$result = $rv;
## no critic (Subroutines::ProhibitExplicitReturnUndef)
$found++ and return undef;
}
return $found ? $result : undef;
}
sub lastidx (&@)
{
my $f = shift;
foreach my $i (reverse 0 .. $#_)
{
local *_ = \$_[$i];
return $i if $f->();
}
return -1;
}
sub lastval (&@)
{
my $test = shift;
my $ix;
for ($ix = $#_; $ix >= 0; $ix--)
{
local *_ = \$_[$ix];
my $testval = $test->();
# Simulate $_ as alias
$_[$ix] = $_;
return $_ if $testval;
}
## no critic (Subroutines::ProhibitExplicitReturnUndef)
return undef;
}
sub lastres (&@)
{
my $test = shift;
my $ix;
for ($ix = $#_; $ix >= 0; $ix--)
{
local *_ = \$_[$ix];
my $testval = $test->();
# Simulate $_ as alias
$_[$ix] = $_;
return $testval if $testval;
}
## no critic (Subroutines::ProhibitExplicitReturnUndef)
return undef;
}
sub insert_after (&$\@)
{
my ($f, $val, $list) = @_;
my $c = &firstidx($f, @$list);
@$list = (@{$list}[0 .. $c], $val, @{$list}[$c + 1 .. $#$list],) and return 1 if $c != -1;
return 0;
}
sub insert_after_string ($$\@)
{
my ($string, $val, $list) = @_;
my $c = firstidx { defined $_ and $string eq $_ } @$list;
@$list = (@{$list}[0 .. $c], $val, @{$list}[$c + 1 .. $#$list],) and return 1 if $c != -1;
return 0;
}
sub apply (&@)
{
my $action = shift;
&$action foreach my @values = @_;
return wantarray ? @values : $values[-1];
}
sub after (&@)
{
my $test = shift;
my $started;
my $lag;
## no critic (BuiltinFunctions::RequireBlockGrep)
return grep $started ||= do
{
my $x = $lag;
$lag = $test->();
$x;
}, @_;
}
sub after_incl (&@)
{
my $test = shift;
my $started;
return grep { $started ||= $test->() } @_;
}
sub before (&@)
{
my $test = shift;
my $more = 1;
return grep { $more &&= !$test->() } @_;
}
sub before_incl (&@)
{
my $test = shift;
my $more = 1;
my $lag = 1;
## no critic (BuiltinFunctions::RequireBlockGrep)
return grep $more &&= do
{
my $x = $lag;
$lag = !$test->();
$x;
}, @_;
}
sub indexes (&@)
{
my $test = shift;
return grep {
local *_ = \$_[$_];
$test->()
} 0 .. $#_;
}
sub pairwise (&\@\@)
{
my $op = shift;
# Symbols for caller's input arrays
use vars qw{ @A @B };
local (*A, *B) = @_;
# Localise $a, $b
my ($caller_a, $caller_b) = do
{
my $pkg = caller();
## no critic (TestingAndDebugging::ProhibitNoStrict, ValuesAndExpressions::ProhibitCommaSeparatedStatements)
no strict 'refs';
\*{$pkg . '::a'}, \*{$pkg . '::b'};
};
# Loop iteration limit
my $limit = $#A > $#B ? $#A : $#B;
## no critic (Variables::RequireInitializationForLocalVars)
# This map expression is also the return value
local (*$caller_a, *$caller_b);
## no critic (BuiltinFunctions::ProhibitComplexMappings)
return map {
# Assign to $a, $b as refs to caller's array elements
(*$caller_a, *$caller_b) = \($#A < $_ ? undef : $A[$_], $#B < $_ ? undef : $B[$_]);
# Perform the transformation
$op->();
} 0 .. $limit;
}
sub each_array (\@;\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@)
{
return each_arrayref(@_);
}
sub each_arrayref
{
my @list = @_; # The list of references to the arrays
my $index = 0; # Which one the caller will get next
my $max = 0; # Number of elements in longest array
# Get the length of the longest input array
foreach (@list)
{
unless (ref $_ eq 'ARRAY')
{
require Carp;
Carp::croak("each_arrayref: argument is not an array reference\n");
}
$max = @$_ if @$_ > $max;
}
# Return the iterator as a closure wrt the above variables.
return sub {
if (@_)
{
my $method = shift;
unless ($method eq 'index')
{
require Carp;
Carp::croak("each_array: unknown argument '$method' passed to iterator.");
}
## no critic (Subroutines::ProhibitExplicitReturnUndef)
return undef if $index == 0 || $index > $max;
# Return current (last fetched) index
return $index - 1;
}
# No more elements to return
return if $index >= $max;
my $i = $index++;
# Return ith elements
## no critic (BuiltinFunctions::RequireBlockMap)
return map $_->[$i], @list;
}
}
sub natatime ($@)
{
my $n = shift;
my @list = @_;
return sub { return splice @list, 0, $n; }
}
# "leaks" when lexically hidden in arrayify
my $flatten;
$flatten = sub {
return map { (ref $_ and ("ARRAY" eq ref $_ or overload::Method($_, '@{}'))) ? ($flatten->(@{$_})) : ($_) } @_;
};
sub arrayify
{
return map { $flatten->($_) } @_;
}
sub mesh (\@\@;\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@)
{
my $max = -1;
$max < $#$_ && ($max = $#$_) foreach @_;
## no critic (BuiltinFunctions::ProhibitComplexMappings)
return map {
my $ix = $_;
## no critic (BuiltinFunctions::RequireBlockMap)
map $_->[$ix], @_;
} 0 .. $max;
}
sub zip6 (\@\@;\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@)
{
my $max = -1;
$max < $#$_ && ($max = $#$_) foreach @_;
## no critic (BuiltinFunctions::ProhibitComplexMappings)
return map {
my $ix = $_;
## no critic (BuiltinFunctions::RequireBlockMap)
[map $_->[$ix], @_];
} 0 .. $max;
}
sub listcmp (\@\@;\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@)
{
my %ret;
for (my $i = 0; $i < scalar @_; ++$i)
{
my %seen;
my $k;
foreach my $w (grep { defined $_ and not $seen{$k = $_}++ } @{$_[$i]})
{
$ret{$w} ||= [];
push @{$ret{$w}}, $i;
}
}
return %ret;
}
sub uniq (@)
{
my %seen = ();
my $k;
my $seen_undef;
return grep { defined $_ ? not $seen{$k = $_}++ : not $seen_undef++ } @_;
}
sub singleton (@)
{
my %seen = ();
my $k;
my $seen_undef;
return grep { 1 == (defined $_ ? $seen{$k = $_} : $seen_undef) }
grep { defined $_ ? not $seen{$k = $_}++ : not $seen_undef++ } @_;
}
sub duplicates (@)
{
my %seen = ();
my $k;
my $seen_undef;
return grep { 1 < (defined $_ ? $seen{$k = $_} : $seen_undef) }
grep { defined $_ ? not $seen{$k = $_}++ : not $seen_undef++ } @_;
}
sub frequency (@)
{
my %seen = ();
my $k;
my $seen_undef;
my %h = map { defined $_ ? ($_ => $seen{$k = $_}) : () }
grep { defined $_ ? not $seen{$k = $_}++ : not $seen_undef++ } @_;
wantarray or return (scalar keys %h) + ($seen_undef ? 1 : 0);
undef $k;
return (%h, $seen_undef ? (\$k => $seen_undef) : ());
}
sub occurrences (@)
{
my %seen = ();
my $k;
my $seen_undef;
my @ret;
foreach my $l (map { $_ } grep { defined $_ ? not $seen{$k = $_}++ : not $seen_undef++ } @_)
{
my $n = defined $l ? $seen{$l} : $seen_undef;
defined $ret[$n] or $ret[$n] = [];
push @{$ret[$n]}, $l;
}
return @ret;
}
sub mode (@)
{
my %seen = ();
my ($max, $k, $seen_undef) = (1);
foreach (@_) { defined $_ ? ($max < ++$seen{$k = $_} and ++$max) : ($max < ++$seen_undef and ++$max) }
wantarray or return $max;
my @ret = ($max);
foreach my $l (grep { $seen{$_} == $max } keys %seen)
{
push @ret, $l;
}
$seen_undef and $seen_undef == $max and push @ret, undef;
return @ret;
}
sub samples ($@)
{
my $n = shift;
if ($n > @_)
{
require Carp;
Carp::croak(sprintf("Cannot get %d samples from %d elements", $n, scalar @_));
}
for (my $i = @_; @_ - $i > $n;)
{
my $idx = @_ - $i;
my $swp = $idx + int(rand(--$i));
my $xchg = $_[$swp];
$_[$swp] = $_[$idx];
$_[$idx] = $xchg;
}
return splice @_, 0, $n;
}
sub minmax (@)
{
return unless @_;
my $min = my $max = $_[0];
for (my $i = 1; $i < @_; $i += 2)
{
if ($_[$i - 1] <= $_[$i])
{
$min = $_[$i - 1] if $min > $_[$i - 1];
$max = $_[$i] if $max < $_[$i];
}
else
{
$min = $_[$i] if $min > $_[$i];
$max = $_[$i - 1] if $max < $_[$i - 1];
}
}
if (@_ & 1)
{
my $i = $#_;
if ($_[$i - 1] <= $_[$i])
{
$min = $_[$i - 1] if $min > $_[$i - 1];
$max = $_[$i] if $max < $_[$i];
}
else
{
$min = $_[$i] if $min > $_[$i];
$max = $_[$i - 1] if $max < $_[$i - 1];
}
}
return ($min, $max);
}
sub minmaxstr (@)
{
return unless @_;
my $min = my $max = $_[0];
for (my $i = 1; $i < @_; $i += 2)
{
if ($_[$i - 1] le $_[$i])
{
$min = $_[$i - 1] if $min gt $_[$i - 1];
$max = $_[$i] if $max lt $_[$i];
}
else
{
$min = $_[$i] if $min gt $_[$i];
$max = $_[$i - 1] if $max lt $_[$i - 1];
}
}
if (@_ & 1)
{
my $i = $#_;
if ($_[$i - 1] le $_[$i])
{
$min = $_[$i - 1] if $min gt $_[$i - 1];
$max = $_[$i] if $max lt $_[$i];
}
else
{
$min = $_[$i] if $min gt $_[$i];
$max = $_[$i - 1] if $max lt $_[$i - 1];
}
}
return ($min, $max);
}
sub part (&@)
{
my ($code, @list) = @_;
my @parts;
push @{$parts[$code->($_)]}, $_ foreach @list;
return @parts;
}
sub bsearch(&@)
{
my $code = shift;
my $rc;
my $i = 0;
my $j = @_;
## no critic (ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions)
do
{
my $k = int(($i + $j) / 2);
$k >= @_ and return;
local *_ = \$_[$k];
$rc = $code->();
$rc == 0
and return wantarray ? $_ : 1;
if ($rc < 0)
{
$i = $k + 1;
}
else
{
$j = $k - 1;
}
} until $i > $j;
return;
}
sub bsearchidx(&@)
{
my $code = shift;
my $rc;
my $i = 0;
my $j = @_;
## no critic (ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions)
do
{
my $k = int(($i + $j) / 2);
$k >= @_ and return -1;
local *_ = \$_[$k];
$rc = $code->();
$rc == 0 and return $k;
if ($rc < 0)
{
$i = $k + 1;
}
else
{
$j = $k - 1;
}
} until $i > $j;
return -1;
}
sub lower_bound(&@)
{
my $code = shift;
my $count = @_;
my $first = 0;
while ($count > 0)
{
my $step = $count >> 1;
my $it = $first + $step;
local *_ = \$_[$it];
if ($code->() < 0)
{
$first = ++$it;
$count -= $step + 1;
}
else
{
$count = $step;
}
}
return $first;
}
sub upper_bound(&@)
{
my $code = shift;
my $count = @_;
my $first = 0;
while ($count > 0)
{
my $step = $count >> 1;
my $it = $first + $step;
local *_ = \$_[$it];
if ($code->() <= 0)
{
$first = ++$it;
$count -= $step + 1;
}
else
{
$count = $step;
}
}
return $first;
}
sub equal_range(&@)
{
my $lb = &lower_bound(@_);
my $ub = &upper_bound(@_);
return ($lb, $ub);
}
sub binsert (&$\@)
{
my $lb = &lower_bound($_[0], @{$_[2]});
splice @{$_[2]}, $lb, 0, $_[1];
return $lb;
}
sub bremove (&\@)
{
my $lb = &lower_bound($_[0], @{$_[1]});
return splice @{$_[1]}, $lb, 1;
}
sub qsort(&\@)
{
require Carp;
Carp::croak("It's insane to use a pure-perl qsort");
}
sub slide(&@)
{
my $op = shift;
my @l = @_;
## no critic (TestingAndDebugging::ProhibitNoStrict, ValuesAndExpressions::ProhibitCommaSeparatedStatements)
# Localise $a, $b
my ($caller_a, $caller_b) = do
{
my $pkg = caller();
no strict 'refs';
\*{$pkg . '::a'}, \*{$pkg . '::b'};
};
## no critic (Variables::RequireInitializationForLocalVars)
# This map expression is also the return value
local (*$caller_a, *$caller_b);
## no critic (BuiltinFunctions::ProhibitComplexMappings)
return map {
# Assign to $a, $b as refs to caller's array elements
(*$caller_a, *$caller_b) = \($l[$_], $l[$_ + 1]);
# Perform the transformation
$op->();
} 0 .. ($#l - 1);
}
sub slideatatime ($$@)
{
my ($m, $w, @list) = @_;
my $n = $w - $m - 1;
return $n >= 0
? sub { my @r = splice @list, 0, $m; $#list < $n and $n = $#list; @r and push @r, (@list ? @list[0 .. $n] : ()); return @r; }
: sub { return splice @list, 0, $m; };
}
sub sort_by(&@)
{
my ($code, @list) = @_;
return map { $_->[0] }
sort { $a->[1] cmp $b->[1] }
map { [$_, scalar($code->())] } @list;
}
sub nsort_by(&@)
{
my ($code, @list) = @_;
return map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { [$_, scalar($code->())] } @list;
}
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
sub _XScompiled { return 0 }
=head1 SEE ALSO
L<List::Util>
=head1 AUTHOR
Jens Rehsack E<lt>rehsack AT cpan.orgE<gt>
Adam Kennedy E<lt>adamk@cpan.orgE<gt>
Tassilo von Parseval E<lt>tassilo.von.parseval@rwth-aachen.deE<gt>
=head1 COPYRIGHT AND LICENSE
Some parts copyright 2011 Aaron Crane.
Copyright 2004 - 2010 by Tassilo von Parseval
Copyright 2013 - 2017 by Jens Rehsack
All code added with 0.417 or later is licensed under the Apache License,
Version 2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
All code until 0.416 is licensed under the same terms as Perl itself,
either Perl version 5.8.4 or, at your option, any later version of
Perl 5 you may have available.
=cut
1;