known_extensions=''
nonxs_ext=''
static_ext=''
+usei18n_lang=''
useopcode=''
useposix=''
extras=''
ccname=''
ccversion=''
perllibs=''
+: set usei18n_lang=false in your hint file to disable the I18N_Langinfo extension.
+usei18n_lang=true
: set useposix=false in your hint file to disable the POSIX extension.
useposix=true
: set useopcode=false in your hint file to disable the Opcode extension.
esac
;;
I18N/Langinfo|i18n_lan)
- case "$i_langinfo$d_nl_langinfo" in
- $define$define) avail_ext="$avail_ext $xxx" ;;
+ case "$usei18n_lang" in
+ true|define|y) avail_ext="$avail_ext $xxx" ;;
esac
;;
IPC/SysV|ipc/sysv)
usedl='$usedl'
usedtrace='$usedtrace'
usefaststdio='$usefaststdio'
+usei18n_lang='$i18n_lang'
useithreads='$useithreads'
usekernprocpathname='$usekernprocpathname'
uselargefiles='$uselargefiles'
- The following extensions are missing for various technical
reasons:
B ByteLoader Devel::DProf Devel::PPPort Encode GDBM_File
- I18N::Langinfo IPC::SysV NDBM_File Opcode PerlIO::encoding POSIX
+ IPC::SysV NDBM_File Opcode PerlIO::encoding POSIX
re Safe Sys::Hostname Sys::Syslog
threads threads::shared Unicode::Normalize
- Using MakeMaker or the Module::* to build and install modules
YESSTR
);
-our $VERSION = '0.15';
+our $VERSION = '0.16';
XSLoader::load();
for the locales for which it makes sense to have ante meridiem and post
meridiem time formats,
- CODESET CRNCYSTR RADIXCHAR
+ CODESET CRNCYSTR
for the character code set being used (such as "ISO8859-1", "cp850",
-"koi8-r", "sjis", "utf8", etc.), for the currency string, for the
+"koi8-r", "sjis", "utf8", etc.), for the currency string
+
+ ALT_DIGITS RADIXCHAR THOUSEP
+
+for an alternate representation of digits, for the
radix character used between the integer and the fractional part
-of decimal numbers (yes, this is redundant with POSIX::localeconv())
+of decimal numbers, the group separator string for large-ish floating point
+numbers (yes, the final two are redundant with POSIX::localeconv())
YESSTR YESEXPR NOSTR NOEXPR
for the Japanese Emperor eras (naturally only defined under Japanese locales).
+Starting in Perl 5.28, this module is available even on systems that lack a
+nativeC<nl_langinfo>. On such systems, it uses various methods to construct
+what that function, if present, would return. But there are potential
+glitches. These are the items that could be different:
+
+=over
+
+=item C<CODESET>
+
+=item C<ERA>
+
+Unimplemented, so returns C<"">.
+
+=item C<YESEXPR>
+
+=item C<YESSTR>
+
+=item C<NOEXPR>
+
+=item C<NOSTR>
+
+Only the values for English are returned. C<YESSTR> and C<NOSTR> have been
+removed from POSIX 2008, and are retained here for backwards compatibility.
+Your platform's C<nl_langinfo> may not support them.
+
+=item C<D_FMT>
+
+Always evaluates to C<%x>, the locale's appropriate date representation.
+
+=item C<T_FMT>
+
+Always evaluates to C<%X>, the locale's appropriate time representation.
+
+=item C<D_T_FMT>
+
+Always evaluates to C<%c>, the locale's appropriate date and time
+representation.
+
+=item C<CRNCYSTR>
+
+The return may be incorrect for those rare locales where the currency symbol
+replaces the radix character.
+Send email to L<mailto:perlbug@perl.org> if you have examples of it needing
+to work differently.
+
+=item C<ALT_DIGITS>
+
+Currently this gives the same results as Linux does.
+Send email to L<mailto:perlbug@perl.org> if you have examples of it needing
+to work differently.
+
+=item C<ERA_D_FMT>
+
+=item C<ERA_T_FMT>
+
+=item C<ERA_D_T_FMT>
+
+=item C<T_FMT_AMPM>
+
+These are derived by using C<strftime()>, and not all versions of that function
+know about them. C<""> is returned for these on such systems.
+
+=back
+
See your L<langinfo(3)> for more information about the available
constants. (Often this means having to look directly at the
F<langinfo.h> C header file.)
-Note that unfortunately none of the above constants are guaranteed
-to be available on a particular platform. To be on the safe side
-you can wrap the import in an eval like this:
-
- eval {
- require I18N::Langinfo;
- I18N::Langinfo->import(qw(langinfo CODESET));
- $codeset = langinfo(CODESET()); # note the ()
- };
- if ($@) { ... failed ... }
-
=head2 EXPORT
By default only the C<langinfo()> function is exported.
#ifdef I_LANGINFO
# define __USE_GNU 1 /* Enables YESSTR, otherwise only __YESSTR. */
# include <langinfo.h>
+#else
+# include <perl_langinfo.h>
#endif
#include "const-c.inc"
RETVAL = newSVpv(Perl_langinfo(code), 0);
}
#else
- croak("nl_langinfo() not implemented on this architecture");
+ RETVAL = newSVpv(Perl_langinfo(code), 0);
#endif
OUTPUT:
RETVAL
C<localeconv> will be overwritten. This means you must save that buffer's
contents if you need to access them after a call to this function.
-The details for those items which may differ from what this emulation returns
-and what a native C<nl_langinfo()> would return are:
-
-=over
-
-=item C<CODESET>
-
-=item C<ERA>
-
-Unimplemented, so returns C<"">.
-
-=item C<YESEXPR>
-
-=item C<YESSTR>
-
-=item C<NOEXPR>
-
-=item C<NOSTR>
-
-Only the values for English are returned. C<YESSTR> and C<NOSTR> have been
-removed from POSIX 2008, and are retained here for backwards compatibility.
-Your platform's C<nl_langinfo> may not support them.
-
-=item C<D_FMT>
-
-Always evaluates to C<%x>, the locale's appropriate date representation.
-
-=item C<T_FMT>
-
-Always evaluates to C<%X>, the locale's appropriate time representation.
-
-=item C<D_T_FMT>
-
-Always evaluates to C<%c>, the locale's appropriate date and time
-representation.
-
-=item C<CRNCYSTR>
-
-The return may be incorrect for those rare locales where the currency symbol
-replaces the radix character.
-Send email to L<mailto:perlbug@perl.org> if you have examples of it needing
-to work differently.
-
-=item C<ALT_DIGITS>
-
-Currently this gives the same results as Linux does.
-Send email to L<mailto:perlbug@perl.org> if you have examples of it needing
-to work differently.
-
-=item C<ERA_D_FMT>
-
-=item C<ERA_T_FMT>
-
-=item C<ERA_D_T_FMT>
-
-=item C<T_FMT_AMPM>
-
-These are derived by using C<strftime()>, and not all versions of that function
-know about them. C<""> is returned for these on such systems.
-
-=back
+The details for those items which may deviate from what this emulation returns
+and what a native C<nl_langinfo()> would return are specified in
+L<I18N::Langinfo>.
=back
* calculate it */
# if defined(USE_LOCALE_CTYPE) \
- && ( (defined(HAS_NL_LANGINFO) && defined(CODESET)) \
+ && ( defined(HAS_NL_LANGINFO) \
|| (defined(HAS_MBTOWC) || defined(HAS_MBRTOWC)))
{
}
# endif
-# if defined(HAS_NL_LANGINFO) && defined(CODESET)
+# if defined(HAS_NL_LANGINFO)
{ /* The task is easiest if the platform has this POSIX 2001 function.
Except on some platforms it can wrongly return "", so have to have
of L<overload> (included with perl 5.14 and earlier) load L<Scalar::Util>
at run time, which will fail if Carp has been invoked after a syntax error.
+L<I18N::Langinfo> has been upgraded from version 0.15 to 0.16.
+
+This module is now available on all platforms, emulating the system
+L<nl_langinfo(3)> on systems that lack it. Some caveats apply, as
+L<detailed in its documentation|I18N::Langinfo>, the most severe being
+that the C<CODESET> item is not implemented on those systems, always
+returning C<"">.
+
=back
=head2 Removed Modules and Pragmata
# ext Devel/DProf nonconst
# ext Devel/PPPort PORT
# ext Encode nonconst Encode/encode.h def_t.c encengine.c
-# ext I18N/Langinfo PORT
+ext I18N/Langinfo PORT
# ext IPC/SysV PORT
# ext NDBM_File PORT
# ext ODBM_File PORT
use warnings;
my $no = join('|',qw(Amiga.* GDBM_File ODBM_File NDBM_File DB_File
- VMS.* Sys-Syslog IPC-SysV I18N-Langinfo));
+ VMS.* Sys-Syslog IPC-SysV));
$no = qr/^(?:$no)$/i;
sub apply_config {
# duplicates logic from Configure (mostly)
push @no, "DB_File" unless $config->{i_db};
push @no, "GDBM_File" unless $config->{i_gdbm};
- push @no, "I18N-Langinfo" unless $config->{i_langinfo} && $config->{d_nl_langinfo};
push @no, "IPC-SysV" unless $config->{d_msg} || $config->{d_sem} || $config->{d_shm};
push @no, "NDBM_File" unless $config->{d_ndbm};
push @no, "ODBM_File"