Changeset 385 for trunk/gsdl/perllib/classify/List.pm
- Timestamp:
- 1999-07-14T14:54:20+12:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/classify/List.pm
r316 r385 10 10 11 11 package List; 12 13 use sorttools; 12 14 13 15 sub new { … … 46 48 if (defined $metavalue) { 47 49 if ($self->{'metaname'} eq 'Creator') { 48 $self->format_string_name_english (\$metavalue);50 &sorttools::format_string_name_english (\$metavalue); 49 51 } else { 50 $self->format_string_english (\$metavalue);52 &sorttools::format_string_english (\$metavalue); 51 53 } 52 54 if (defined $self->{'list'}->{$doc_OID}) { … … 88 90 89 91 90 # format an english name for sorting91 # i.e. convert to lowercase, put surname before92 # first names etc.93 sub format_string_name_english {94 my $self = shift (@_);95 my ($stringref) = @_;96 97 $$stringref =~ tr/A-Z/a-z/;98 $$stringref =~ s/[^a-z0-9 ]//g;99 $$stringref =~ s/\s+/ /g;100 $$stringref =~ s/^\s+//;101 my @names = split / /, $$stringref;102 my $surname = pop @names;103 while (scalar @names && $surname =~ /^(jnr|snr)$/i) {104 $surname = pop @names;105 }106 $$stringref = $surname . " " . $$stringref;107 }108 109 # format an english string for sorting110 # i.e. convert to lowercase, remove the, a or an111 # from beginning of string etc.112 sub format_string_english {113 my $self = shift (@_);114 my ($stringref) = @_;115 116 $$stringref =~ tr/A-Z/a-z/;117 $$stringref =~ s/[^a-z0-9 ]//g;118 $$stringref =~ s/^\s*(the|a|an)\b//;119 $$stringref =~ s/^\s+//;120 }121 122 123 92 1;
Note:
See TracChangeset
for help on using the changeset viewer.