1N/A # This AUTOLOAD is used to 'autoload' constants from the constant() 1N/A croak "&I18N::Langinfo::constant not defined" if $
constname eq 'constant';
1N/A # Fixed between 5.005_53 and 5.005_61 1N/A#XXX if ($] >= 5.00561) { 1N/A#XXX *$AUTOLOAD = sub () { $val }; 1N/AI18N::Langinfo - query locale information 1N/AThe langinfo() function queries various locale information that can be 1N/Aused to localize output and user interfaces. The langinfo() requires 1N/Aone numeric argument that identifies the locale constant to query: 1N/Aif no argument is supplied, C<$_> is used. The numeric constants 1N/Aappropriate to be used as arguments are exportable from I18N::Langinfo. 1N/AThe following example will import the langinfo() function itself and 1N/Athree constants to be used as arguments to langinfo(): a constant for 1N/Athe abbreviated first day of the week (the numbering starts from 1N/ASunday = 1) and two more constants for the affirmative and negative 1N/Aanswers for a yes/no question in the current locale. 1N/A use I18N::Langinfo qw(langinfo ABDAY_1 YESSTR NOSTR); 1N/A my ($abday_1, $yesstr, $nostr) = map { langinfo } qw(ABDAY_1 YESSTR NOSTR); 1N/A print "$abday_1? [$yesstr/$nostr] "; 1N/AIn other words, in the "C" (or English) locale the above will probably 1N/Aprint something like: 1N/Abut under a French locale 1N/AThe usually available constants are 1N/A ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7 1N/A ABMON_1 ABMON_2 ABMON_3 ABMON_4 ABMON_5 ABMON_6 1N/A ABMON_7 ABMON_8 ABMON_9 ABMON_10 ABMON_11 ABMON_12 1N/A DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7 1N/A MON_1 MON_2 MON_3 MON_4 MON_5 MON_6 1N/A MON_7 MON_8 MON_9 MON_10 MON_11 MON_12 1N/Afor abbreviated and full length days of the week and months of the year, 1N/Afor the date-time, date, and time formats used by the strftime() function 1N/A AM_STR PM_STR T_FMT_AMPM 1N/Afor the locales for which it makes sense to have ante meridiem and post 1N/Ameridiem time formats, 1N/A CODESET CRNCYSTR RADIXCHAR 1N/Afor the character code set being used (such as "ISO8859-1", "cp850", 1N/A"koi8-r", "sjis", "utf8", etc.), for the currency string, for the 1N/Aradix character used between the integer and the fractional part 1N/Aof decimal numbers (yes, this is redundant with POSIX::localeconv()) 1N/A YESSTR YESEXPR NOSTR NOEXPR 1N/Afor the affirmative and negative responses and expressions, and 1N/A ERA ERA_D_FMT ERA_D_T_FMT ERA_T_FMT 1N/Afor the Japanese Emperor eras (naturally only defined under Japanese locales). 1N/ASee your L<langinfo(3)> for more information about the available 1N/Aconstants. (Often this means having to look directly at the 1N/AF<langinfo.h> C header file.) 1N/ANote that unfortunately none of the above constants are guaranteed 1N/Ato be available on a particular platform. To be on the safe side 1N/Ayou can wrap the import in an eval like this: 1N/A require I18N::Langinfo; 1N/A I18N::Langinfo->import(qw(langinfo CODESET)); 1N/A $codeset = langinfo(CODESET()); # note the () 1N/A if (!$@) { ... failed ... } 1N/ANothing is exported by default. 1N/AThe langinfo() is just a wrapper for the C nl_langinfo() interface. 1N/AJarkko Hietaniemi, E<lt>jhi@hut.fiE<gt> 1N/A=head1 COPYRIGHT AND LICENSE 1N/ACopyright 2001 by Jarkko Hietaniemi 1N/AThis library is free software; you can redistribute it and/or modify 1N/Ait under the same terms as Perl itself.