X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXUtil.pm;h=2c814ea33d834cbe5001eede20eecc0755059695;hb=2177bb0e95a5ec8797f5a0d47bd2070666a92653;hp=10b3538767822ef46735fb4cc2a8b267e7a8c024;hpb=363839f98405239478bbe5a85efad1d679a1c722;p=spider.git diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index 10b35387..2c814ea3 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -183,6 +183,14 @@ sub parraypairs return $out; } +sub _sort_fields +{ + my $ref = shift; + my @a = split /,/, $ref->field_prompt(shift); + my @b = split /,/, $ref->field_prompt(shift); + return lc $a[1] cmp lc $b[1]; +} + # print all the fields for a record according to privilege # # The prompt record is of the format ',[,' @@ -198,7 +206,7 @@ sub print_all_fields my $width = $self->width - 1; $width ||= 80; - foreach $field (sort {$ref->field_prompt($a) cmp $ref->field_prompt($b)} @fields) { + foreach $field (sort {_sort_fields($ref, $a, $b)} @fields) { if (defined $ref->{$field}) { my ($priv, $ans) = promptf($ref->field_prompt($field), $ref->{$field}); my @tmp;