[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Quilt-dev] Call for 0.42
From: |
Jean Delvare |
Subject: |
Re: [Quilt-dev] Call for 0.42 |
Date: |
Sat, 23 Jul 2005 23:05:13 +0200 |
Hi Andreas,
[Andreas Gruenbacher]
> Calling setlocale with a value that is possibly wrong doesn't appeal
> to me. I'd prefer this:
>
> BEGIN {
> if (eval { require Locale::gettext }) {
> import Locale::gettext;
> require POSIX;
> import POSIX, qw(setlocale LC_MESSAGES);
> } else {
I am reluctant to explicitely importing LC_MESSAGES here, as perl 5.6.x
doesn't know about it. We did not import it explicitely at first and it
was working, so I don't see why it would now be needed. As a matter of
fact, it works fine for me without it.
So, here is my latest proposal:
--- scripts/remove-trailing-ws.in 18 Jul 2005 22:15:26 -0000 1.2
+++ scripts/remove-trailing-ws.in 23 Jul 2005 20:43:47 -0000
@@ -8,10 +8,25 @@
use strict;
use FileHandle;
use File::Temp qw( :mktemp );
-use POSIX qw(setlocale);
-use Locale::gettext;
use Getopt::Std;
use vars qw($opt_p $opt_n);
+
+# This trick lets the script work even if gettext support is missing.
+BEGIN {
+ if (eval { require Locale::gettext }) {
+ import Locale::gettext;
+ require POSIX;
+ import POSIX, qw(setlocale);
+ } else {
+ eval '
+ use constant LC_MESSAGES => 0;
+ sub setlocale($$) { }
+ sub bindtextdomain($$) { }
+ sub textdomain($) { }
+ sub gettext($) { shift }
+ '
+ }
+}
setlocale(LC_MESSAGES, "");
bindtextdomain("quilt", "@LOCALEDIR@");
Thanks,
--
Jean Delvare
- [Quilt-dev] Call for 0.42, Jean Delvare, 2005/07/19
- Re: [Quilt-dev] Call for 0.42, Andreas Gruenbacher, 2005/07/19
- Re: [Quilt-dev] Call for 0.42, Jean Delvare, 2005/07/20
- Re: [Quilt-dev] Call for 0.42, Jean Delvare, 2005/07/21
- Re: [Quilt-dev] Call for 0.42, Andreas Gruenbacher, 2005/07/21
- Re: [Quilt-dev] Call for 0.42, Jean Delvare, 2005/07/22
- Re: [Quilt-dev] Call for 0.42, Andreas Gruenbacher, 2005/07/22
- Re: [Quilt-dev] Call for 0.42, Jean Delvare, 2005/07/22
- Re: [Quilt-dev] Call for 0.42, Andreas Gruenbacher, 2005/07/22
- Re: [Quilt-dev] Call for 0.42, Andreas Gruenbacher, 2005/07/22
- Re: [Quilt-dev] Call for 0.42,
Jean Delvare <=
- Re: [Quilt-dev] Call for 0.42, Andreas Gruenbacher, 2005/07/23
- Re: [Quilt-dev] Call for 0.42, Jean Delvare, 2005/07/24
- Re: [Quilt-dev] Call for 0.42, Martin Quinson, 2005/07/24
- Re: [Quilt-dev] Call for 0.42, Jean Delvare, 2005/07/25