Subject: | Bug in Semphore when using non english locale |
Date: | Sat, 28 Feb 2009 19:26:24 +0100 |
To: | <bug-Log-Log4perl [...] rt.cpan.org> |
From: | "Koehler, Martin" <martin.koehler [...] desy.de> |
Hi,
Thanks for the great module.
The Module Log4perl::Util::Semaphore assumes english locale.
Creating a semaphore fails e.g. for a german locale, whenever the semaphore already exists.
The code generating the error is:
if(! defined $self->{id} and
$! =~ /exists/) { # <- This does not work in geman, since the message # there is "Die Datei existiert bereits" does # not match
print "Semaphore '$self->{key}' already exists\n" if INTERNAL_DEBUG;
$self->{id} = semget( $self->{ikey}, 1, 0 )
or die "semget($self->{ikey}) failed: $!";
} elsif($!) {
die "Cannot create semaphore $self->{key}/$self->{ikey} ($!)";
}
}
You might try to force the us locale using
use POSIX qw(locale_h);
setlocale(LC_ALL,"en_US");
which worked for me :-)
Regards
------------------------------------------------------------------------
Dr. Martin Köhler
Head of library and documentation
Deutsches Elektronen-Synchrotron DESY
Building 01 Room 310
phone: +49-40-8998-1814 Notkestr. 85
fax: +49-40-8994-1814 22607 Hamburg
e-mail: Martin.Koehler@desy.de Germany
------------------------------------------------------------------------