Index: gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key.pm
===================================================================
--- gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key.pm	(revision 27037)
+++ gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key.pm	(revision 27037)
@@ -0,0 +1,348 @@
+package Sort::Key;
+
+our $VERSION = '1.32';
+
+use 5.006;
+
+use strict;
+use warnings;
+use Carp;
+
+use Sort::Key::Types;
+
+require Exporter;
+
+our @ISA = qw(Exporter);
+our @EXPORT_OK = qw( nsort nsort_inplace
+		     isort isort_inplace
+		     usort usort_inplace
+		     rsort rsort_inplace
+		     rnsort rnsort_inplace
+		     risort risort_inplace
+		     rusort rusort_inplace
+
+		     keysort keysort_inplace
+		     rkeysort rkeysort_inplace
+		     nkeysort nkeysort_inplace
+		     rnkeysort rnkeysort_inplace
+		     ikeysort ikeysort_inplace
+		     rikeysort rikeysort_inplace
+		     ukeysort ukeysort_inplace
+		     rukeysort rukeysort_inplace
+
+		     multikeysorter multikeysorter_inplace);
+
+require XSLoader;
+XSLoader::load('Sort::Key', $VERSION);
+
+sub multikeysorter {
+    if (ref $_[0] eq 'CODE') {
+	my $keygen = shift;
+	@_ or croak "too few keys";
+        my $ptypes = Sort::Key::Types::combine_types(@_);
+	my $sub = Sort::Key::Types::combine_sub($keygen, undef, @_);
+	return _multikeysorter($ptypes, $sub, undef);
+    }
+    else {
+	@_ or croak "too few keys";
+        my $ptypes = Sort::Key::Types::combine_types(@_);
+	my $sub = Sort::Key::Types::combine_sub('@_', undef, @_);
+	return _multikeysorter($ptypes, undef, $sub)
+    }
+}
+
+sub multikeysorter_inplace {
+    if (ref $_[0] eq 'CODE') {
+	my $keygen = shift;
+	@_ or croak "too few keys";
+        my $ptypes = Sort::Key::Types::combine_types(@_);
+	my $sub = Sort::Key::Types::combine_sub($keygen, undef, @_);
+	return _multikeysorter_inplace($ptypes, $sub, undef);
+    }
+    else {
+	@_ or croak "too few keys";
+        my $ptypes = Sort::Key::Types::combine_types(@_);
+	my $sub = Sort::Key::Types::combine_sub('@_', undef, @_);
+	return _multikeysorter_inplace($ptypes, undef, $sub);
+    }
+}
+
+sub register_type {
+    warn "Warning, Sort::Key API changed: register_type function has been moved to module Sort::Key::Types";
+    goto &Sort::Key::Types::register_type;
+}
+
+
+1;
+
+__END__
+
+=head1 NAME
+
+Sort::Key - the fastest way to sort anything in Perl
+
+=head1 SYNOPSIS
+
+  use Sort::Key qw(keysort nkeysort ikeysort);
+
+  @by_name = keysort { "$_->{surname} $_->{name}" } @people;
+
+  # sorting by a numeric key:
+  @by_age = nkeysort { $_->{age} } @people;
+
+  # sorting by a numeric integer key:
+  @by_sons = ikeysort { $_->{sons} } @people;
+
+=head1 DESCRIPTION
+
+Sort::Key provides a set of functions to sort lists of values by some
+calculated key value.
+
+It is faster (usually B<much faster>) and uses less memory than other
+alternatives implemented around perl sort function (ST, GRT, etc.).
+
+Multikey sorting functionality is also provided via the companion
+modules L<Sort::Key::Multi>, L<Sort::Key::Maker> and
+L<Sort::Key::Register>.
+
+=head2 FUNCTIONS
+
+This module provides a large number of sorting subroutines but
+they are all variations off the C<keysort> one:
+
+  @sorted = keysort { CALC_KEY($_) } @data
+
+that is conceptually equivalent to
+
+  @sorted = sort { CALC_KEY($a) cmp CALC_KEY($b) } @data
+
+and where C<CALC_KEY($_)> can be any expresion to extract the key
+value from C<$_> (not only a subroutine call).
+
+For instance, some variations are C<nkeysort> that performs a numeric
+comparison, C<rkeysort> that orders the data in descending order,
+C<ikeysort> and C<ukeysort> that are optimized versions of C<nkeysort>
+that can be used when the keys are integers or unsigned integers
+respectively, etc.
+
+Also, inplace versions of the sorters are provided. For instance
+
+  keysort_inplace { CALC_KEY($_) } @data
+
+that is equivalent to
+
+  @data = keysort { CALC_KEY($_) } @data
+
+but being (a bit) faster and using less memory.
+
+The full list of subroutines that can be imported from this module
+follows:
+
+=over 4
+
+=item keysort { CALC_KEY } @array
+
+returns the elements on C<@array> sorted by the key calculated
+applying C<{ CALC_KEY }> to them.
+
+Inside C<{ CALC_KEY }>, the object is available as C<$_>.
+
+For example:
+
+  @a=({name=>john, surname=>smith}, {name=>paul, surname=>belvedere});
+  @by_name=keysort {$_->{name}} @a;
+
+This function honours the C<use locale> pragma.
+
+=item nkeysort { CALC_KEY } @array
+
+similar to keysort but compares the keys numerically instead of
+as strings.
+
+This function honours the C<use integer> pragma, i.e.:
+
+  use integer;
+  my @s=(2.4, 2.0, 1.6, 1.2, 0.8);
+  my @ns = nkeysort { $_ } @s;
+  print "@ns\n"
+
+prints
+
+  0.8 1.6 1.2 2.4 2
+
+=item rnkeysort { CALC_KEY } @array
+
+works as nkeysort, comparing keys in reverse (or descending) numerical order.
+
+=item ikeysort { CALC_KEY } @array
+
+works as keysort but compares the keys as integers (32 bits or more,
+no checking is performed for overflows).
+
+=item rikeysort { CALC_KEY } @array
+
+works as ikeysort, but in reverse (or descending) order.
+
+=item ukeysort { CALC_KEY } @array
+
+works as keysort but compares the keys as unsigned integers (32 bits
+or more).
+
+For instance, it can be used to efficiently sort IP4 addresses:
+
+  my @data = qw(1.2.3.4 4.3.2.1 11.1.111.1 222.12.1.34
+                0.0.0.0 255.255.255.0) 127.0.0.1);
+
+  my @sorted = ukeysort {
+                   my @a = split /\./;
+                   (((($a[0] << 8) + $a[1] << 8) + $a[2] << 8) + $a[3])
+               } @data;
+
+=item rukeysort { CALC_KEY } @array
+
+works as ukeysort, but in reverse (or descending) order.
+
+=item keysort_inplace { CALC_KEY } @array
+
+=item nkeysort_inplace { CALC_KEY } @array
+
+=item ikeysort_inplace { CALC_KEY } @array
+
+=item ukeysort_inplace { CALC_KEY } @array
+
+=item rkeysort_inplace { CALC_KEY } @array
+
+=item rnkeysort_inplace { CALC_KEY } @array
+
+=item rikeysort_inplace { CALC_KEY } @array
+
+=item rukeysort_inplace { CALC_KEY } @array
+
+work as the corresponding keysort functions but sorting the array
+inplace.
+
+=item rsort @array
+
+=item nsort @array
+
+=item rnsort @array
+
+=item isort @array
+
+=item risort @array
+
+=item usort @array
+
+=item rusort @array
+
+=item rsort_inplace @array
+
+=item nsort_inplace @array
+
+=item rnsort_inplace @array
+
+=item isort_inplace @array
+
+=item risort_inplace @array
+
+=item usort_inplace @array
+
+=item rusort_inplace @array
+
+are simplified versions of its keysort cousins. They use the own
+values as the sorting keys.
+
+For instance those constructions are equivalent:
+
+  @sorted = nsort @foo;
+
+  @sorted = nkeysort { $_ } @foo;
+
+  @sorted = sort { $a <=> $b } @foo;
+
+
+=item multikeysorter(@types)
+
+=item multikeysorter_inplace(@types)
+
+=item multikeysorter(\&genkeys, @types)
+
+=item multikeysorter_inplace(\&genkeys, @types)
+
+are the low level interface to the multikey sorting functionality
+(normally, you should use L<Sort::Key::Maker> and
+L<Sort::Key::Register> or L<Sort::Key::Multi> instead).
+
+They get a list of keys descriptions and return a reference to a
+multikey sorting subroutine.
+
+Types accepted by default are:
+
+  string, str, locale, loc, integer, int,
+  unsigned_integer, uint, number, num
+
+and support for additional types can be added via the L<register_type>
+subroutine available from L<Sort::Key::Types> or the more
+friendly interface available from L<Sort::Key::Register>.
+
+Types can be preceded by a minus sign to indicate descending order.
+
+If the first argument is a reference to a subroutine it is used as the
+multikey extraction function. If not, the generated sorters
+expect one as their first argument.
+
+Example:
+
+  my $sorter1 = multikeysorter(sub {length $_, $_}, qw(int str));
+  my @sorted1 = &$sorter1(qw(foo fo o of oof));
+
+  my $sorter2 = multikeysorter(qw(int str));
+  my @sorted2 = &$sorter2(sub {length $_, $_}, qw(foo fo o of oof));
+
+
+=back
+
+
+=head1 SEE ALSO
+
+perl L<sort> function, L<integer>, L<locale>.
+
+Companion modules L<Sort::Key::Multi>, L<Sort::Key::Register>,
+L<Sort::Key::Maker> and L<Sort::Key::Natural>.
+
+L<Sort::Key::IPv4>, L<Sort::Key::DateTime> and L<Sort::Key::OID>
+modules add support for additional datatypes to Sort::Key.
+
+L<Sort::Key::External> allows to sort huge lists that do not fit in
+the available memory.
+
+Other interesting Perl sorting modules are L<Sort::Maker>,
+L<Sort::Naturally> and L<Sort::External>.
+
+=head1 SUPPORT
+
+To report bugs, send me and email or use the CPAN bug tracking system
+at L<http://rt.cpan.org>.
+
+=head2 Commercial support
+
+Commercial support, professional services and custom software
+development around this module are available through my current
+company. Drop me an email with a rough description of your
+requirements and we will get back to you ASAP.
+
+=head2 My wishlist
+
+If you like this module and you're feeling generous, take a look at my
+Amazon Wish List: L<http://amzn.com/w/1WU1P6IR5QZ42>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2005-2007, 2012 by Salvador FandiE<ntilde>o,
+E<lt>sfandino@yahoo.comE<gt>.
+
+This library is free software; you can redistribute it and/or modify
+it 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
Index: gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key/Maker.pm
===================================================================
--- gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key/Maker.pm	(revision 27037)
+++ gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key/Maker.pm	(revision 27037)
@@ -0,0 +1,120 @@
+package Sort::Key::Maker;
+
+our $VERSION = '0.02';
+
+use warnings;
+use strict;
+
+use Sort::Key qw(multikeysorter multikeysorter_inplace);
+
+use Carp;
+our @CARP_NOT = qw(Sort::Key);
+
+sub import {
+    my $class = shift;
+    my $name = shift;
+    my $caller = caller;
+
+    no strict 'refs';
+    *{"${caller}::${name}"} = multikeysorter @_;
+    *{"${caller}::${name}_inplace"} = multikeysorter_inplace @_;
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Sort::Key::Maker - multikey sorter creator
+
+=head1 SYNOPSYS
+
+  # create a function that sorts strings by length:
+  use Sort::Key::Maker sort_by_length => sub { length $_},  qw(integer);
+
+  # create a multikey sort function;
+  # first key is integer sorted in descending order,
+  # second key is a string in default (ascending) order:
+  use Sort::Key::Maker ri_s_keysort => qw(-integer string);
+
+  # some sample data...
+  my @foo = qw(foo bar t too tood mama);
+
+  # and now, use the sorter functions previously made:
+
+  # get the values on @foo sorted by length:
+  my @sorted = sort_by_length @foo;
+
+  # sort @foo inplace by its length and then by its value:
+  ri_s_keysort_inplace { length $_, $_ } @foo;
+
+
+=head1 DESCRIPTION
+
+Sort::Key::Maker is a pragmatic module that provides an easy to use
+interface to Sort::Key multikey sorting functionality.
+
+It creates multikey sorting functions on the fly for any key type
+combination and exports them to the caller package.
+
+The key types natively accepted are:
+
+  string, str, locale, loc, integer, int,
+  unsigned_integer, uint, number, num
+
+and support for other types can be added via L<Sort::Key::Register> (or
+also via L<Sort::Key::register_type()>).
+
+=head2 USAGE
+
+=over 4
+
+=item use Sort::Key::Maker foo_sort =E<gt> @keys;
+
+exports two subroutines to the caller package: C<foo_sort (&@)> and
+C<foo_sort_inplace (&\@)>.
+
+Those two subroutines require a sub reference as their first argument
+and then respectively, the list to be sorted or an array.
+
+For instance:
+
+  use Sort::Key::Maker bar_sort => qw(int int str);
+
+  @bar=qw(doo tomo 45s tio);
+  @sorted = bar_sort { unpack "CCs", $_ } @bar;
+  # or sorting @bar inplace
+  bar_sort_inplace { unpack "CCs", $_ } @bar;
+
+=item use Sort::Key::Maker foo_sort =E<gt> \&genmultikey, @keys;
+
+when the first argument after the sorter name is a reference to a
+subroutine it is used as the multikey extraction function. The
+generated sorter functions doesn't require neither accept one, i.e.:
+
+  use Sort::Key::Maker sort_by_length => sub { length $_ }, 'int';
+  my @sorted = sort_by_length qw(foo goo h mama picasso);
+
+=back
+
+=head1 SEE ALSO
+
+L<Sort::Key>, L<Sort::Key::Register>.
+
+L<Sort::Maker> also available from CPAN provides similar
+functionality.
+
+=head1 AUTHOR
+
+Salvador FandiE<ntilde>o, E<lt>sfandino@yahoo.comE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2005 by Salvador FandiE<ntilde>o
+
+This library is free software; you can redistribute it and/or modify
+it 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
Index: gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key/Multi.pm
===================================================================
--- gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key/Multi.pm	(revision 27037)
+++ gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key/Multi.pm	(revision 27037)
@@ -0,0 +1,117 @@
+package Sort::Key::Multi;
+
+our $VERSION = '1.30';
+
+use warnings;
+use strict;
+
+use Sort::Key qw(multikeysorter multikeysorter_inplace);
+use Sort::Key::Types;
+
+use Carp;
+our @CARP_NOT = qw(Sort::Key);
+
+my %sub;
+my %type = qw( i integer
+	       u unsigned_integer
+	       n number
+	       s string
+	       l locale);
+
+my $one_char_types = join('', keys %Sort::Key::Types::mktypes);
+
+sub import {
+    shift;
+    for my $name (@_) {
+	my $sub = $sub{$name};
+	unless (defined $sub) {
+	    my ($types, $inplace) = $name =~ /^((?:r?[$one_char_types]\d*_*)+)keysort((?:_?inplace)?)$/o
+		or croak "invalid name for multikey sorter '$name'";
+	    my @types;
+	    while ($types =~ /(r?)(.)(\d*)_*/g) {
+		my ($r, $t, $n) = ($1, $2, $3);
+		push @types, ( ($r ? '-' : '') . $type{$t} ) x ($n || 1);
+	    }
+	    # print STDERR "$types => @types\n";
+	    if ($inplace) {
+		$sub = multikeysorter_inplace(@types);
+	    }
+	    else {
+		$sub = multikeysorter(@types);
+	    }
+	}
+	my $caller = caller;
+	no strict 'refs';
+	*{$caller."::".$name} = $sub;
+    }
+}
+
+1;
+
+=head1 NAME
+
+Sort::Key::Multi - simple multikey sorts
+
+=head1 SYNOPSIS
+
+    use Sort::Key::Multi qw(sikeysort);
+    my @data = qw(foo0 foo1 bar34 bar0 bar34 bar33 doz4)
+    my @sisorted = sikeysort { /(\w+)(\d+)/} @data;
+
+=head1 DESCRIPTION
+
+Sort::Key::Multi creates multikey sorting subroutines and exports them
+to the caller package.
+
+The names of the sorters are of the form C<xxxkeysort> or
+C<xxxkeysort_inplace>, where C<xxx> determines the number and types of
+the keys as follows:
+
+=over 4
+
++ C<i> indicates an integer key, C<u> indicates an unsigned integer
+key, C<n> indicates a numeric key, C<s> indicates a string key and
+C<l> indicates a string key that obeys locale order configuration.
+
++ Type characters can be prefixed by C<r> to indicate reverse order.
+
++ A number following a type character indicates that the key type has
+to be repeated as many times (for instance C<i3> is equivalent to
+C<iii> and C<rs2> is equivalent to C<rsrs>).
+
++ Underscores (C<_>) can be freely used between type indicators.
+
+=back
+
+For instace:
+
+   use Key::Sort::Multi qw(iirskeysort
+                           i2rskeysort
+                           i_i_rs__keysort
+                           i2rs_keysort);
+
+exports to the caller package fourth identical sorting functions that
+take two integer keys that are sorted in ascending order and one
+string key that is sorted in descending order.
+
+The generated sorters take as first argument a subroutine that is used
+to extract the keys from the values which are passed inside C<$_>, for
+example:
+
+  my @data = qw(1.3.foo 1.3.bar 2.3.bar 1.4.bar 1.7.foo);
+  my @s = i2rs_keysort { split /\./, $_ } @data;
+
+=head1 SEE ALSO
+
+For a more general multikey sorter generator see L<Sort::Key::Maker>.
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006 by Salvador FandiE<ntilde>o
+E<lt>sfandino@yahoo.comE<gt>
+
+This library is free software; you can redistribute it and/or modify
+it 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
Index: gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key/Natural.pm
===================================================================
--- gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key/Natural.pm	(revision 27037)
+++ gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key/Natural.pm	(revision 27037)
@@ -0,0 +1,267 @@
+package Sort::Key::Natural;
+
+our $VERSION = '0.04';
+
+use strict;
+use warnings;
+
+require Exporter;
+
+our @ISA = qw( Exporter );
+our @EXPORT_OK = qw( natkeysort
+		     natkeysort_inplace
+		     rnatkeysort
+		     rnatkeysort_inplace
+		     mkkey_natural
+		     natsort
+		     rnatsort
+		     natsort_inplace
+		     rnatsort_inplace 
+
+                     natwfkeysort
+		     natwfkeysort_inplace
+		     rnatwfkeysort
+		     rnatwfkeysort_inplace
+		     mkkey_natural_with_floats
+		     natwfsort
+		     rnatwfsort
+		     natwfsort_inplace
+		     rnatwfsort_inplace );
+
+
+require locale;
+
+sub mkkey_natural {
+    my $nat = @_ ? shift : $_;
+    my @parts = do {
+        if ((caller 0)[8] & $locale::hint_bits) {
+            use locale;
+            $nat =~ /\d+|\p{IsAlpha}+/g;
+        }
+        else {
+            $nat =~ /\d+|\p{IsAlpha}+/g;
+        }
+    };
+    for (@parts) {
+	if (/^\d/) {
+	    s/^0+//;
+	    my $len = length;
+	    my $nines = int ($len / 9);
+	    my $rest = $len - 9 * $nines;
+	    $_ = ('9' x $nines) . $rest . $_;
+	}
+    }
+    return join("\0", @parts);
+}
+
+use Sort::Key::Register natural => \&mkkey_natural, 'string';
+use Sort::Key::Register nat => \&mkkey_natural, 'string';
+
+use Sort::Key::Maker natkeysort => 'nat';
+use Sort::Key::Maker rnatkeysort => '-nat';
+use Sort::Key::Maker natsort => \&mkkey_natural, 'str';
+use Sort::Key::Maker rnatsort => \&mkkey_natural, '-str';
+
+sub mkkey_natural_with_floats {
+    my $nat = @_ ? shift : $_;
+    my @parts = do {
+        if ((caller 0)[8] & $locale::hint_bits) {
+            use locale;
+            $nat =~ /[+\-]?\d+(?:\.\d*)?|\p{IsAlpha}+/g;
+        }
+        else {
+            $nat =~ /[+\-]?\d+(?:\.\d*)?|\p{IsAlpha}+/g;
+        }
+    };
+    for (@parts) {
+        if (my ($sign, $number, $dec) = /^([+-]?)(\d+)(?:\.(\d*))?$/) {
+            $number =~ s/^0+//;
+            $dec = '' unless defined $dec;
+            $dec =~ s/0+$//;
+	    my $len = length $number;
+	    my $nines = int ($len / 9);
+	    my $rest = $len - 9 * $nines;
+            $_ = ('9' x $nines) . $rest . $number . $dec;
+            if ($sign eq '-' and $_ ne '0') {
+                tr/0123456789/9876543210/;
+                $_ = "-$_";
+            }
+	}
+    }
+    return join("\0", @parts);
+}
+
+use Sort::Key::Register natural_with_floats => \&mkkey_natural_with_floats, 'string';
+use Sort::Key::Register natwf => \&mkkey_natural_with_floats, 'string';
+
+use Sort::Key::Maker natwfkeysort => 'natwf';
+use Sort::Key::Maker rnatwfkeysort => '-natwf';
+use Sort::Key::Maker natwfsort => \&mkkey_natural_with_floats, 'str';
+use Sort::Key::Maker rnatwfsort => \&mkkey_natural_with_floats, '-str';
+
+
+1;
+
+=head1 NAME
+
+Sort::Key::Natural - fast natural sorting
+
+=head1 SYNOPSIS
+
+    use Sort::Key::Natural qw(natsort);
+
+    my @data = qw(foo1 foo23 foo6 bar12 bar1
+		  foo bar2 bar-45 foomatic b-a-r-45);
+
+    my @sorted = natsort @data;
+
+    print "@sorted\n";
+    # prints:
+    #   b-a-r-45 bar1 bar2 bar12 bar-45 foo foo1 foo6 foo23 foomatic
+
+    use Sort::Key::Natural qw(natkeysort);
+
+    my @objects = (...);
+    my @sorted = natkeysort { $_->get_id } @objects;
+
+
+=head1 DESCRIPTION
+
+This module extends the L<Sort::Key> family of modules to support
+natural sorting.
+
+Under natural sorting, strings are splitted at word and number
+boundaries, and the resulting substrings
+are compared as follows:
+
+=over 4
+
+=item *
+
+numeric substrings are compared numerically
+
+=item *
+
+alphabetic substrings are compared lexically
+
+=item *
+
+numeric substrings come always before alphabetic substrings
+
+=back
+
+Spaces, symbols and non-printable characters are only considered for
+splitting the string into its parts but not for sorting. For instance
+C<foo-bar-42> is broken in three substrings C<foo>, C<bar> and C<42>
+and after that the dashes are ignored.
+
+Note, that the sorting is case sensitive. To do a case insensitive
+sort you have to convert the keys explicitly:
+
+  my @sorted = natkeysort { lc $_ } @data
+
+Also, once this module is loaded, the new type C<natural> (or C<nat>) will
+be available from L<Sort::Key::Maker>. For instance:
+
+  use Sort::Key::Natural;
+  use Sort::Key::Maker i_rnat_keysort => qw(integer -natural);
+
+creates a multikey sorter C<i_rnat_keysort> accepting two keys, the
+first to be compared as an integer and the second in natural
+descending order.
+
+There is also an alternative set of natural sorting functions that
+recognize floating point numbers. They use the key type C<natwf>
+(abreviation of C<natural_with_floats>).
+
+=head2 FUNCTIONS
+
+the functions that can be imported from this module are:
+
+=over 4
+
+=item natsort @data
+
+returns the elements of C<@data> sorted in natural order.
+
+=item rnatsort @data
+
+returns the elements of C<@data> sorted in natural descending order.
+
+=item natkeysort { CALC_KEY($_) } @data
+
+returns the elements on C<@array> naturally sorted by the keys
+resulting from applying them C<CALC_KEY>.
+
+=item rnatkeysort { CALC_KEY($_) } @data
+
+is similar to C<natkeysort> but sorts the elements in descending
+order.
+
+=item natsort_inplace @data
+
+=item rnatsort_inplace @data
+
+=item natkeysort_inplace { CALC_KEY($_) } @data
+
+=item rnatkeysort_inplace { CALC_KEY($_) } @data
+
+these functions are similar respectively to C<natsort>, C<rnatsort>,
+C<natsortkey> and C<rnatsortkey>, but they sort the array C<@data> in
+place.
+
+=item $key = mkkey_natural $string
+
+given C<$string>, returns a key that can be compared lexicographically
+to another key obtained in the same manner, results in the same order
+as comparing the former strings as in the natural order.
+
+If the argument C<$key> is not provided it defaults to C<$_>.
+
+=item natwfsort @data
+
+=item rnatwfsort @data
+
+=item natkeywfsort { CALC_KEY($_) } @data
+
+=item rnatkeywfsort { CALC_KEY($_) } @data
+
+=item natwfsort_inplace @data
+
+=item rnatwfsort_inplace @data
+
+=item natkeywfsort_inplace { CALC_KEY($_) } @data
+
+=item rnatkeywfsort_inplace { CALC_KEY($_) } @data
+
+=item mkkey_natural_with_floats $key
+
+this ugly named set of functions perform in the same way as its
+s/natwf/nat/ counterpart with the difference that they honor floating
+point numbers embeded inside the strings.
+
+In this context a floating point number is a string matching the
+regular expression C</[+\-]?\d+(\.\d*)?/>. Note that numbers with an
+exponent part (i.e. C<1.12E-12>) are not recognized as such.
+
+Note also that numbers without an integer part (i.e. C<.2> or C<-.12>)
+are not supported either.
+
+=back
+
+=head1 SEE ALSO
+
+L<Sort::Key>, L<Sort::Key::Maker>.
+
+Other module providing similar functionality is L<Sort::Naturally>.
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006, 2012 by Salvador FandiE<ntilde>o,
+E<lt>sfandino@yahoo.comE<gt>.
+
+This library is free software; you can redistribute it and/or modify
+it 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
Index: gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key/Register.pm
===================================================================
--- gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key/Register.pm	(revision 27037)
+++ gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key/Register.pm	(revision 27037)
@@ -0,0 +1,94 @@
+package Sort::Key::Register;
+
+our $VERSION = '1.30';
+
+use warnings;
+use strict;
+
+use Sort::Key;
+
+sub import {
+    my $class = shift;
+    my $name = shift;
+    if (@_ == 1) {
+	Sort::Key::Types::register_type($name, undef, @_);
+    }
+    else {
+	Sort::Key::Types::register_type($name, @_);
+    }
+}
+
+1;
+__END__
+
+=head1 NAME
+
+Sort::Key::Register - tell Sort::Key how to sort new data types.
+
+=head1 SYNOPSYS
+
+  use Sort::Key::Register Person =>
+      sub { $_->surname, $_->name },
+      qw(string string);
+
+  use Sort::Key::Register 'Color::Component' => 'integer';
+
+  use Sort::Key::Register Color =>
+      sub { $_->R, $_->G, $_->B },
+      ('Color::Component') x 3;
+
+
+=head1 DESCRIPTION
+
+Sort::Key::Register allows to register new data types with Sort::Key
+so that they can be sorted as natively supported ones.
+
+It works as a pragma module and doesn't export any function, all its
+functionality is provided via C<use>:
+
+  use Sort::Key::Register ...
+
+To avoid collisions between modules registering types with the same
+name, you should qualify them with the package name.
+
+  use Sort::Key::Register 'MyPkg::foo' => sub { $_ }, '-int';
+
+  # or using __PACKAGE__:
+  use Sort::Key::Register __PACKAGE__, sub { $_ }, '-int';
+
+=head2 USAGE
+
+=over 4
+
+=item use Sort::Key::Register $name => \&multikeygen, @keytypes;
+
+registers type C<$name>.
+
+C<&multikeygen> is the multikey extraction function for the type and
+C<@keytypes> are the types of the extracted keys.
+
+=item use Sort::Key::Register $name => $keytype;
+
+this 'use' is useful for simple types that are sorted as another type
+already registered, maybe changing the direction of the sort
+(ascending or descending).
+
+=back
+
+=head1 SEE ALSO
+
+L<Sort::Key>, L<Sort::Key::Maker>.
+
+=head1 AUTHOR
+
+Salvador FandiE<ntilde>o, E<lt>sfandino@yahoo.comE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2005 by Salvador FandiE<ntilde>o
+
+This library is free software; you can redistribute it and/or modify
+it 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
Index: gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key/Types.pm
===================================================================
--- gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key/Types.pm	(revision 27037)
+++ gs2-extensions/parallel-building/trunk/src/perllib/cpan/Sort/Key/Types.pm	(revision 27037)
@@ -0,0 +1,226 @@
+package Sort::Key::Types;
+
+our $VERSION = '1.30';
+
+use strict;
+use warnings;
+use Carp;
+
+require Exporter;
+our @ISA = qw(Exporter);
+our @EXPORT_OK = qw(register_type);
+
+our $DEBUG;
+$DEBUG ||= 0;
+
+# this hash is also used from Sort::Key::Multi to find out which
+# letters can be used as types:
+
+our %mktypes = ( s => 0,
+                 l => 1,
+                 n => 2,
+                 i => 3,
+                 u => 4 );
+
+sub _mks2n {
+    if (my ($rev, $key)=$_[0]=~/^([-+]?)(.)$/) {
+	exists $mktypes{$key}
+	    or croak "invalid multikey type '$_[0]'";
+	my $n = $mktypes{$key};
+	$n+=128 if $rev eq '-';
+	return $n
+    }
+    die "internal error, bad key '$_[0]'";
+}
+
+our %mkmap = qw(str s
+		string s
+		locale l
+		loc l
+		lstr l
+		int i
+		integer i
+		uint u
+		unsigned_integer u
+		number n
+		num n);
+
+$_ = [$_] for (values %mkmap);
+our %mksub = map { $_ => undef } keys %mkmap;
+
+sub _get_map {
+    my ($rev, $name) = $_[0]=~/^([+-]?)(.*)$/;
+    exists $mkmap{$name}
+	or croak "unknown key type '$name'\n";
+    if ($rev eq '-') {
+	return map { /^-(.*)$/ ? $1 : "-$_" } @{$mkmap{$name}}
+    }
+    @{$mkmap{$name}}
+}
+
+sub _get_sub {
+    $_[0]=~/^[+-]?(.*)$/;
+    exists $mksub{$1}
+	or croak "unknown key type '$1'\n";
+    return $mksub{$1}
+}
+
+sub _combine_map { map { _get_map $_ } @_ }
+
+use constant _nl => "\n";
+
+sub combine_types { pack('C*', (map { _mks2n $_ } _combine_map(@_))) }
+
+sub combine_sub {
+    my $sub = shift;
+    my $for = shift;
+    $for = defined $for ? " for $for" : "";
+
+    my @subs = map { _get_sub $_ } @_;
+
+    if ($sub) {
+	my $code = 'sub { '._nl;
+	if (ref $sub eq 'CODE') {
+	    unless (grep { defined $_ } @subs) {
+		return $sub
+	    }
+	    $code.= 'my @keys = &{$sub};'._nl;
+	}
+	else {
+	    if ($sub eq '@_') {
+		return undef unless grep {defined $_} @subs;
+	    }
+	    $code.= 'my @keys = '.$sub.';'._nl;
+	}
+	$code.= 'print "in: |@keys|\n";'._nl if $DEBUG;
+
+	$code.= '@keys == '.scalar(@_)
+	  . ' or croak "wrong number of keys generated$for '
+	    . '(expected '.scalar(@_).', returned ".scalar(@keys).")";'._nl;
+
+	{ # new scope so @map doesn't get captured
+	    my @map = _combine_map @_;
+	    if (@map==@_) {
+		for my $i (0..$#_) {
+		    if (defined $subs[$i]) {
+			$code.= '{ local $_ = $keys['.$i.']; ($keys['.$i.']) = &{$subs['.$i.']}() }'._nl;
+		    }
+		}
+		$code.='print "out: |@keys|\n";'._nl if $DEBUG;
+		$code.='return @keys'._nl;
+	    }
+	    else {
+		$code.='my @keys1;'._nl;
+		for my $i (0..$#_) {
+		    if (defined $subs[$i]) {
+			$code.= '{ local $_ = shift @keys; push @keys1, &{$subs['.$i.']}() }'._nl;
+		    }
+		    else {
+			$code.= 'push @keys1, shift @keys;'._nl;
+		    }
+		}
+		$code.='print "out: |@keys1|\n";'._nl if $DEBUG;
+		$code.='return @keys1'._nl;
+	    }
+	}
+	$code.='}'._nl;
+	print "CODE$for:\n$code----\n" if $DEBUG >= 2;
+	my $map = eval $code;
+	$@ and die "internal error: code generation failed ($@)";
+	return $map;
+    }
+    else {
+	@_==1 or croak "too many keys or keygen subroutine undefined$for";
+	return @subs;
+    }
+}
+
+sub register_type {
+    my $name = shift;
+    my $sub = shift;
+    $name=~/^\w+(?:::\w+)*$/
+	or croak "invalid type name '$name'";
+    @_ or
+	croak "too few keys";
+    (exists $mkmap{$name} or exists $mktypes{$name})
+	and croak "type '$name' already registered or reserved in ".__PACKAGE__;
+    $mkmap{$name} = [ _combine_map @_ ];
+    $mksub{$name} = combine_sub $sub, $name, @_;
+    ()
+}
+
+
+1;
+
+__END__
+
+=head1 Sort::Key::Types - handle Sort::Key data types
+
+=head1 SYNOPSIS
+
+  use Sort::Key::Types qw(register_type);
+  register_type(Color => sub { $_->R, $_->G, $_->B }, qw(int, int, int));
+
+  # you better
+  # use Sort::Key::Register ...
+
+
+=head1 DESCRIPTION
+
+The L<Sort::Key> family of modules can be extended to support new key
+types using this module (or the more friendly L<Sort::Key::Register>).
+
+=head2 FUNCTIONS
+
+The following functions are provided:
+
+=over 4
+
+=item Sort::Key::register_type($name, \&gensubkeys, @subkeystypes)
+
+registers a new datatype named C<$name> defining how to convert it to
+a multikey.
+
+C<&gensubkeys> should convert the object of type C<$name> passed on
+C<$_> to a list of values composing the multikey.
+
+C<@subkeystypes> is the list of types for the generated multikeys.
+
+For instance:
+
+  Sort::Key::Types::register_type
+                 'Person',
+                 sub { $_->surname,
+                       $_->name,
+                       $_->middlename },
+                 qw(str str str);
+
+  Sort::Key::Types::register_type
+                 'Color',
+                 sub { $_->R, $_->G, $_->B },
+                 qw(int int int);
+
+Once a datatype has been registered it can be used in the same way
+as types supported natively, even for defining new types, i.e.:
+
+  Sort::Key::Types::register_type
+                 'Family',
+                 sub { $_->father, $_->mother },
+                 qw(Person Person);
+
+=back
+
+=head1 SEE ALSO
+
+L<Sort::Key>, L<Sort::Key::Merger>, L<Sort::Key::Register>.
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2005-2007 by Salvador FandiE<ntilde>o,
+E<lt>sfandino@yahoo.comE<gt>.
+
+This library is free software; you can redistribute it and/or modify
+it 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
