diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-07-28 16:40:00 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-07-28 16:40:00 +0000 |
commit | bce512bc41bf288fc6f94d3e092f525dd8541345 (patch) | |
tree | 021a32939dd6b8f6f25a43b1f00176eb80a69a3f | |
parent | c1ce79a112218c16ae4d8b15a00038dcc5d55066 (diff) | |
download | perl-MDK-Common-bce512bc41bf288fc6f94d3e092f525dd8541345.tar perl-MDK-Common-bce512bc41bf288fc6f94d3e092f525dd8541345.tar.gz perl-MDK-Common-bce512bc41bf288fc6f94d3e092f525dd8541345.tar.bz2 perl-MDK-Common-bce512bc41bf288fc6f94d3e092f525dd8541345.tar.xz perl-MDK-Common-bce512bc41bf288fc6f94d3e092f525dd8541345.zip |
MDK::Common::DataStructure: add sort_numbers
-rw-r--r-- | MDK/Common/DataStructure.pm | 7 | ||||
-rw-r--r-- | perl-MDK-Common.spec | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/MDK/Common/DataStructure.pm b/MDK/Common/DataStructure.pm index f139555..0becc8d 100644 --- a/MDK/Common/DataStructure.pm +++ b/MDK/Common/DataStructure.pm @@ -10,6 +10,10 @@ MDK::Common::DataStructure - miscellaneous list/hash manipulation functions =over +=item sort_numbers(LIST) + +numerical sort (small numbers at beginning) + =item ikeys(HASH) aka I<sorted integer keys>, as simple as C<sort { $a E<lt>=E<gt> $b } keys> @@ -106,10 +110,11 @@ use MDK::Common::Func; use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK); @ISA = qw(Exporter); -@EXPORT_OK = qw(ikeys add2hash add2hash_ put_in_hash member invbool listlength deref deref_array is_empty_array_ref is_empty_hash_ref uniq difference2 intersection next_val_in_array group_by2 list2kv); +@EXPORT_OK = qw(sort_numbers ikeys add2hash add2hash_ put_in_hash member invbool listlength deref deref_array is_empty_array_ref is_empty_hash_ref uniq difference2 intersection next_val_in_array group_by2 list2kv); %EXPORT_TAGS = (all => [ @EXPORT_OK ]); +sub sort_numbers { sort { $a <=> $b } @_ } sub ikeys { my %l = @_; sort { $a <=> $b } keys %l } sub put_in_hash { my ($a, $b) = @_; while (my ($k, $v) = each %{$b || {}}) { $a->{$k} = $v } $a } sub add2hash { my ($a, $b) = @_; while (my ($k, $v) = each %{$b || {}}) { $a->{$k} ||= $v } $a } diff --git a/perl-MDK-Common.spec b/perl-MDK-Common.spec index cde28fc..8b84776 100644 --- a/perl-MDK-Common.spec +++ b/perl-MDK-Common.spec @@ -2,7 +2,7 @@ # do not change the version here, change in MDK/Common.pm.pl %define version THEVERSION -%define release 7mdk +%define release 8mdk Summary: Various simple functions Name: perl-MDK-Common @@ -49,6 +49,9 @@ rm -rf $RPM_BUILD_ROOT # MODIFY IN THE CVS: cvs.mandrakesoft.com:/cooker soft/perl-MDK-Common %changelog +* Sun Jul 28 2002 Pixel <pixel@mandrakesoft.com> 1.0.3-8mdk +- MDK::Common::DataStructure: add sort_numbers + * Thu Jul 25 2002 Pixel <pixel@mandrakesoft.com> 1.0.3-7mdk - add Various::internal_error - export Various::noreturn |