lib/TWiki/Configure/Checkers/LowerNational.pm
changeset 0 414e01d06fd5
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lib/TWiki/Configure/Checkers/LowerNational.pm	Sat Jan 26 15:50:53 2008 +0100
     1.3 @@ -0,0 +1,48 @@
     1.4 +#
     1.5 +# TWiki Enterprise Collaboration Platform, http://TWiki.org/
     1.6 +#
     1.7 +# Copyright (C) 2000-2006 TWiki Contributors.
     1.8 +#
     1.9 +# This program is free software; you can redistribute it and/or
    1.10 +# modify it under the terms of the GNU General Public License
    1.11 +# as published by the Free Software Foundation; either version 2
    1.12 +# of the License, or (at your option) any later version. For
    1.13 +# more details read LICENSE in the root of this distribution.
    1.14 +#
    1.15 +# This program is distributed in the hope that it will be useful,
    1.16 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.17 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    1.18 +#
    1.19 +# As per the GPL, removal of this notice is prohibited.
    1.20 +package TWiki::Configure::Checkers::LowerNational;
    1.21 +use base 'TWiki::Configure::Checker';
    1.22 +
    1.23 +use strict;
    1.24 +
    1.25 +sub check {
    1.26 +    my $this = shift;
    1.27 +
    1.28 +    # support upgrade from old configuration, where LowerNational and
    1.29 +    # UpperNational were stored as REGEX'es (now they are STRING's):
    1.30 +    if ($TWiki::cfg{LowerNational} =~ /^\(\?-xism:(.*)\)$/) {
    1.31 +        $TWiki::cfg{LowerNational} = $1;
    1.32 +    }
    1.33 +
    1.34 +    if( $] < 5.006 || !$TWiki::cfg{UseLocale} ) {
    1.35 +        # Locales are off/broken, or using pre-5.6 Perl, so have to 
    1.36 +        # explicitly list the accented characters (but not if using UTF-8)
    1.37 +        my $forLowerNat = join '', grep { uc($_) ne $_ and m/[^a-z]/ } map { chr($_) } 1..255;
    1.38 +
    1.39 +        if ($forLowerNat) {
    1.40 +            return $this->WARN( <<HERE
    1.41 +The following lower case accented characters have been found in this locale
    1.42 +and should be considered for use in this parameter:
    1.43 +<strong>$forLowerNat</strong>
    1.44 +HERE
    1.45 +                       );
    1.46 +        }
    1.47 +    }
    1.48 +    return '';
    1.49 +}
    1.50 +
    1.51 +1;