It is avaliable from http://www.limey.net/~fiji/perl/
Sorry about the silly version number but I want the version to track
that of the Unicode allkeys.txt file and then I needed some more bits
to stash the rev of the module in (in case I need to rev it separately
to the main thing).
Anyway, it doesn't do anything sophisticated to allow the user to
automatically get a new version of the file. I may do that in a later
release.
An open issue is that it overwrites allkeys. I propose a small patch
to Unicode::Collate to fix that problem. Basically it adds a new file
customkeys.txt that will allow users to specify a site-wide tailoring
that all code using Unicode::Collate will automatically use unless
they have overriden the tailoring explicitly. customkeys.txt is
preferred to allkeys.txt if customkeys.txt is present. If this seems
reasonable I can provide the requisite doc patches.
-ben
--- ../Unicode-Collate-0.24/Collate.pm 2003-04-03 09:50:48.000000000
-0500
+++ Collate.pm 2003-05-14 14:49:48.000000000 -0400
@@ -25,6 +25,7 @@
(our $Path = $INC{'Unicode/Collate.pm'}) =~ s/\.pm$//;
our $KeyFile = "allkeys.txt";
+our $CustomKeyFile = "customkeys.txt";
our $UNICODE_VERSION;
@@ -261,7 +262,7 @@
my $self = bless { @_ }, $class;
# If undef is passed explicitly, no file is read.
- $self->{table} = $KeyFile if ! exists $self->{table};
+ $self->{table} = '' if ! exists $self->{table};
$self->read_table if defined $self->{table};
if ($self->{entry}) {
@@ -291,9 +292,20 @@
sub read_table {
my $self = shift;
- my $file = $self->{table} ne '' ? $self->{table} : $KeyFile;
+ my $file = $self->{table};
+ # Try the following in order:
+ # - The user specified file
+ # - The site customized file (customkeys.txt)
+ # - The default unicode file (allkeys.txt)
my $filepath = File::Spec->catfile($Path, $file);
+ if ($file eq '') {
+ foreach $file ($KeyFile, $CustomKeyFile) {
+ $filepath = File::Spec->catfile($Path, $file);
+ last if -f $filepath;
+ }
+ }
+
open my $fk, "<$filepath"
or croak "File does not exist at $filepath";