lib/TWiki/Configure/Checkers/LowerNational.pm
author Colas Nahaboo <colas@nahaboo.net>
Sat, 26 Jan 2008 15:50:53 +0100
changeset 0 414e01d06fd5
permissions -rw-r--r--
RELEASE 4.2.0 freetown
     1 #
     2 # TWiki Enterprise Collaboration Platform, http://TWiki.org/
     3 #
     4 # Copyright (C) 2000-2006 TWiki Contributors.
     5 #
     6 # This program is free software; you can redistribute it and/or
     7 # modify it under the terms of the GNU General Public License
     8 # as published by the Free Software Foundation; either version 2
     9 # of the License, or (at your option) any later version. For
    10 # more details read LICENSE in the root of this distribution.
    11 #
    12 # This program is distributed in the hope that it will be useful,
    13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    15 #
    16 # As per the GPL, removal of this notice is prohibited.
    17 package TWiki::Configure::Checkers::LowerNational;
    18 use base 'TWiki::Configure::Checker';
    19 
    20 use strict;
    21 
    22 sub check {
    23     my $this = shift;
    24 
    25     # support upgrade from old configuration, where LowerNational and
    26     # UpperNational were stored as REGEX'es (now they are STRING's):
    27     if ($TWiki::cfg{LowerNational} =~ /^\(\?-xism:(.*)\)$/) {
    28         $TWiki::cfg{LowerNational} = $1;
    29     }
    30 
    31     if( $] < 5.006 || !$TWiki::cfg{UseLocale} ) {
    32         # Locales are off/broken, or using pre-5.6 Perl, so have to 
    33         # explicitly list the accented characters (but not if using UTF-8)
    34         my $forLowerNat = join '', grep { uc($_) ne $_ and m/[^a-z]/ } map { chr($_) } 1..255;
    35 
    36         if ($forLowerNat) {
    37             return $this->WARN( <<HERE
    38 The following lower case accented characters have been found in this locale
    39 and should be considered for use in this parameter:
    40 <strong>$forLowerNat</strong>
    41 HERE
    42                        );
    43         }
    44     }
    45     return '';
    46 }
    47 
    48 1;