X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperllocale.pod;h=f680c73109a560648fcd286e99609676a2abb40e;hb=cea6626fc5e04af2c1d079dd4d3784eb2c21174b;hp=3d9a58a0071b17c7275060ca82052122d541cdd2;hpb=22d4bb9ccb8701e68f9243547d7e3a3c55f70908;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perllocale.pod b/pod/perllocale.pod index 3d9a58a..f680c73 100644 --- a/pod/perllocale.pod +++ b/pod/perllocale.pod @@ -124,8 +124,8 @@ B (strftime()) uses C. =back -C, C, and so on, are discussed further in L. +C, C, and so on, are discussed further in +L. The default behavior is restored with the S> pragma, or upon reaching the end of block enclosing C. @@ -348,8 +348,8 @@ commands. You may see things like "en_US.ISO8859-1", but that isn't the same. In this case, try running under a locale that you can list and which somehow matches what you tried. The rules for matching locale names are a bit vague because -standardization is weak in this area. See again the L about general rules. +standardization is weak in this area. See again the +L about general rules. =head2 Fixing system locale configuration @@ -381,7 +381,7 @@ with a single parameter--see L.) localeconv() takes no arguments, and returns B a hash. The keys of this hash are variable names for formatting, such as C and C. The values are the -corresponding, er, values. See L for a longer +corresponding, er, values. See L for a longer example listing the categories an implementation might be expected to provide; some provide more and others fewer. You don't need an explicit C, because localeconv() always observes the @@ -445,7 +445,7 @@ The following collations all make sense and you may meet any of them if you "use locale". A B C D E a b c d e - A a B b C c D d D e + A a B b C c D d E e a A b B c C d D e E a b c d e A B C D E @@ -453,13 +453,13 @@ Here is a code snippet to tell what "word" characters are in the current locale, in that locale's order: use locale; - print +(sort grep /\w/, map { chr() } 0..255), "\n"; + print +(sort grep /\w/, map { chr } 0..255), "\n"; Compare this with the characters that you see and their order if you state explicitly that the locale should be ignored: no locale; - print +(sort grep /\w/, map { chr() } 0..255), "\n"; + print +(sort grep /\w/, map { chr } 0..255), "\n"; This machine-native collation (which is what you get unless S> has appeared earlier in the same block) must be used for @@ -554,20 +554,20 @@ change the character used for the decimal point--perhaps from '.' to ','. These functions aren't aware of such niceties as thousands separation and so on. (See L if you care about these things.) -Output produced by print() is B affected by the -current locale: it is independent of whether C or C is in effect, and corresponds to what you'd get from printf() -in the "C" locale. The same is true for Perl's internal conversions -between numeric and string formats: +Output produced by print() is also affected by the current locale: it +depends on whether C or C is in effect, and +corresponds to what you'd get from printf() in the "C" locale. The +same is true for Perl's internal conversions between numeric and +string formats: use POSIX qw(strtod); use locale; $n = 5/2; # Assign numeric 2.5 to $n - $a = " $n"; # Locale-independent conversion to string + $a = " $n"; # Locale-dependent conversion to string - print "half five is $n\n"; # Locale-independent output + print "half five is $n\n"; # Locale-dependent output printf "half five is %g\n", $n; # Locale-dependent output @@ -580,11 +580,12 @@ The C standard defines the C category, but no function that is affected by its contents. (Those with experience of standards committees will recognize that the working group decided to punt on the issue.) Consequently, Perl takes no notice of it. If you really want -to use C, you can query its contents--see L--and use the information that it returns in your application's -own formatting of currency amounts. However, you may well find that -the information, voluminous and complex though it may be, still does not -quite meet your requirements: currency formatting is a hard nut to crack. +to use C, you can query its contents--see +L--and use the information that it returns in your +application's own formatting of currency amounts. However, you may well +find that the information, voluminous and complex though it may be, still +does not quite meet your requirements: currency formatting is a hard nut +to crack. =head2 LC_TIME @@ -642,15 +643,6 @@ case-mapping table is in effect. =item * -Some systems are broken in that they allow the "C" locale to be -overridden by users. If the decimal point character in the -C category of the "C" locale is surreptitiously changed -from a dot to a comma, C produces a -string result of "123,456". Many people would interpret this as -one hundred and twenty-three thousand, four hundred and fifty-six. - -=item * - A sneaky C locale could result in the names of students with "D" grades appearing ahead of those with "A"s. @@ -686,16 +678,22 @@ the locale: =over 4 -=item B (C, C, C, C and C): +=item * + +B (C, C, C, C and C): Scalar true/false (or less/equal/greater) result is never tainted. -=item B (with C<\l>, C<\L>, C<\u> or C<\U>) +=item * + +B (with C<\l>, C<\L>, C<\u> or C<\U>) Result string containing interpolated material is tainted if C is in effect. -=item B (C): +=item * + +B (C): Scalar true/false result never tainted. @@ -708,7 +706,9 @@ expression contains C<\w> (to match an alphanumeric character), C<\W> C is in effect and the regular expression contains C<\w>, C<\W>, C<\s>, or C<\S>. -=item B (C): +=item * + +B (C): Has the same behavior as the match operator. Also, the left operand of C<=~> becomes tainted when C in effect @@ -716,20 +716,30 @@ if modified as a result of a substitution based on a regular expression match involving C<\w>, C<\W>, C<\s>, or C<\S>; or of case-mapping with C<\l>, C<\L>,C<\u> or C<\U>. -=item B (printf() and write()): +=item * -Success/failure result is never tainted. +B (printf() and write()): -=item B (lc(), lcfirst(), uc(), ucfirst()): +Results are never tainted because otherwise even output from print, +for example C, should be tainted if C is in +effect. + +=item * + +B (lc(), lcfirst(), uc(), ucfirst()): Results are tainted if C is in effect. -=item B (localeconv(), strcoll(), +=item * + +B (localeconv(), strcoll(), strftime(), strxfrm()): Results are never tainted. -=item B (isalnum(), isalpha(), isdigit(), +=item * + +B (isalnum(), isalpha(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), isxdigit()): @@ -954,12 +964,12 @@ operating system upgrade. =head1 SEE ALSO -L, L, L, -L, L, L, -L, L, L, -L, L, L, -L, L, L, -L. +L, L, L, +L, L, L, +L, L, L, +L, L, L, +L, L, L, +L. =head1 HISTORY