develooper Front page | perl.i18n | Postings from November 2005

Re: long strings and xgettext.pl

Thread Previous
From:
Guido Flohr
Date:
November 9, 2005 09:23
Subject:
Re: long strings and xgettext.pl
Message ID:
4372308A.5090700@imperia.net
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sava Chankov wrote:
| Guido Flohr wrote:
|>Still BTW, it is generally a bad idea to use a single underscore as
|>an alias for gettext().  That function is automatically global.
|
| I don't understand neither why a name of underscore makes a function
automatically global nor why is it a bad idea gettext() to be global.
Could you please explain?

I can't tell you why that is.  But you can easily test it.  Define a
function "_" in one Module.pm and you can call it without any
declaration from AnotherModule.pm.

In C, "_" is usually something like

#define _(arg) dgettext (DOMAINNAME, arg)

This allows libraries to use independent message catalogs.  With a
global function, you cannot achieve this.  Locale::TextDomain therefore
uses a double underscore as the default shortcut function.

Besides, "_" is also a magic file handle that caches the information
from the last call to stat() or lstat().  See the pod for File::Find.

Regards,
Guido
- --
Imperia AG, Development
Leyboldstr. 10 - D-50354 Hürth - http://www.imperia.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFDcjCJOo0HNPWNDz0RAjUkAKDpveMo9dJa8ZjuJUGUD/v54EiddgCg2bGd
1ME2WCXxKu0Yaa/ZKbOCz00=
=qWTn
-----END PGP SIGNATURE-----


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About