X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXUtil.pm;h=9d475ed89c8f2f17713b3aabdc9aa6c79d93d4df;hb=f440e0d41cde05ede965cbf664bfcdbe6ed149f0;hp=10b3538767822ef46735fb4cc2a8b267e7a8c024;hpb=412fb1b9e4070d7791f4e986b55bbc0c06f612ea;p=spider.git diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index 10b35387..9d475ed8 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; @@ -343,7 +351,7 @@ sub is_pcflag # check that a thing is a frequency sub is_freq { - return $_[0] =~ /^[\d\.]+$/; + return $_[0] =~ /^\d+(?:\.\d+)?$/; } # check that a thing is just digits