cvsuser 03/12/03 08:23:31
Modified: App-Repository/lib/App Repository.pm
Log:
sort directions can be asc/desc as well as UP/DOWN
Revision Changes Path
1.9 +6 -6 p5ee/App-Repository/lib/App/Repository.pm
Index: Repository.pm
===================================================================
RCS file: /cvs/public/p5ee/App-Repository/lib/App/Repository.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -r1.8 -r1.9
--- Repository.pm 18 Nov 2003 21:38:09 -0000 1.8
+++ Repository.pm 3 Dec 2003 16:23:31 -0000 1.9
@@ -1,6 +1,6 @@
#############################################################################
-## $Id: Repository.pm,v 1.8 2003/11/18 21:38:09 spadkins Exp $
+## $Id: Repository.pm,v 1.9 2003/12/03 16:23:31 spadkins Exp $
#############################################################################
package App::Repository;
@@ -2449,19 +2449,19 @@
=cut
sub rows_by_indexed_values {
- my ($pos, $key, $type, $dir, $sign);
+ my ($pos, $idx, $type, $dir, $sign);
for ($pos = 0; $pos <= $#App::Repository::sort_keys; $pos++) {
- $key = $App::Repository::sort_keys[$pos];
+ $idx = $App::Repository::sort_keys[$pos];
$type = $App::Repository::sort_types[$pos];
$dir = $App::Repository::sort_dirs[$pos];
if (defined $type && $type eq "N") {
- $sign = ($a->[$key] <=> $b->[$key]);
+ $sign = ($a->[$idx] <=> $b->[$idx]);
}
else {
- $sign = ($a->[$key] cmp $b->[$key]);
+ $sign = ($a->[$idx] cmp $b->[$idx]);
}
if ($sign) {
- $sign = -$sign if (defined $dir && $dir eq "DOWN");
+ $sign = -$sign if (defined $dir && $dir =~ /^[Dd]/); # ("DOWN", "desc",
etc.)
return ($sign);
}
}