Skip to content

Commit

Permalink
Item13897: Removed all 'use locale'; replaced 'use Moo' with 'use Fos…
Browse files Browse the repository at this point in the history
…wiki::Class'

- Added corresponding locale warnings to checkers anyhow related to
UseLocae LSC key.
  • Loading branch information
vrurg committed Oct 10, 2016
1 parent 05f7777 commit fd070b6
Show file tree
Hide file tree
Showing 196 changed files with 139 additions and 1,582 deletions.
9 changes: 0 additions & 9 deletions InterwikiPlugin/lib/Foswiki/Plugins/InterwikiPlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ my $sitePattern;
my $pagePattern;
my %interSiteTable;

BEGIN {

# 'Use locale' for internationalisation of Perl sorting and searching -
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}
}

# Read preferences and get all InterWiki Site->URL mappings
sub initPlugin {
my ( $topic, $web, $user, $installWeb ) = @_;
Expand Down
9 changes: 1 addition & 8 deletions PlainFileStoreContrib/lib/Foswiki/Store/PlainFile.pm
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ use Foswiki::Serialise ();
use Try::Tiny;
use Unicode::Normalize;

use Moo;
use namespace::clean;
use Foswiki::Class;
extends qw(Foswiki::Store);

# Web Preferences topic *file* name
Expand All @@ -79,12 +78,6 @@ our $json = JSON->new->pretty(0);

BEGIN {

# Import the locale for sorting
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}

if ($Foswiki::UNICODE) {
require Encode;

Expand Down
8 changes: 1 addition & 7 deletions RCSStoreContrib/lib/Foswiki/Store/Rcs/Handler.pm
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,11 @@ use Foswiki::Meta ();
use Foswiki::Serialise ();
use Foswiki::Users::BaseUserMapping ();

use Moo;
use namespace::clean;
use Foswiki::Class;
extends qw(Foswiki::Object);

# use the locale if required to ensure sort order is correct
BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}

*_decode = \&Foswiki::Store::decode;
*_encode = \&Foswiki::Store::encode;
*_stat = \&Foswiki::Store::Rcs::Store::_stat;
Expand Down
8 changes: 1 addition & 7 deletions RCSStoreContrib/lib/Foswiki/Store/Rcs/RcsLiteHandler.pm
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ use Foswiki::Store ();
use Foswiki::Sandbox ();
use Foswiki::Exception();

use Moo;
use namespace::clean;
use Foswiki::Class;
extends qw(Foswiki::Store::Rcs::Handler);

# SMELL: This code uses the log field for the checkin comment. This field is alongside the actual text
Expand Down Expand Up @@ -125,11 +124,6 @@ use constant CAN_IGNORE_COMMENT => 0; # 1
#

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}

*_decode = \&Foswiki::Store::decode;
*_encode = \&Foswiki::Store::encode;
}
Expand Down
8 changes: 1 addition & 7 deletions RCSStoreContrib/lib/Foswiki/Store/Rcs/RcsWrapHandler.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,10 @@ use Assert;
use Foswiki::Sandbox ();
use Foswiki::Exception();

use Moo;
use namespace::clean;
use Foswiki::Class;
extends qw(Foswiki::Store::Rcs::Handler);

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}

*_decode = \&Foswiki::Store::decode;
*_encode = \&Foswiki::Store::encode;
}
Expand Down
9 changes: 1 addition & 8 deletions RCSStoreContrib/lib/Foswiki/Store/Rcs/Store.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ use Foswiki::Sandbox ();
use Foswiki::Serialise ();
use Foswiki::Exception ();

use Moo;
use namespace::clean;
use Foswiki::Class;
extends qw(Foswiki::Store);

has searchFn => ( is => 'rw', );
Expand All @@ -51,12 +50,6 @@ has searchQueryObj => ( is => 'rw', );

BEGIN {

# Do a dynamic 'use locale' for this module
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}

# The RCS Handler code works on bytes, so we have to mediate
if ($Foswiki::UNICODE) {
require Encode;
Expand Down
7 changes: 0 additions & 7 deletions TablePlugin/lib/Foswiki/Plugins/TablePlugin/Core.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ use Error qw(:try);

use Unicode::Normalize;

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}
}

my @curTable;
my $translationToken;
my $insideTABLE;
Expand Down
5 changes: 0 additions & 5 deletions core/lib/Foswiki.pm
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@ BEGIN {
use version 0.77; $VERSION = version->declare('v2.99.0');
$RELEASE = 'Foswiki-2.99.0';

#if ( $Foswiki::cfg{UseLocale} ) {
# require locale;
# import locale();
#}

# Set environment var FOSWIKI_NOTAINT to disable taint checks even
# if Taint::Runtime is installed
if ( DEBUG && !$ENV{FOSWIKI_NOTAINT} ) {
Expand Down
11 changes: 1 addition & 10 deletions core/lib/Foswiki/Access.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,11 @@ use v5.14;

use Assert;

use Moo;
use namespace::clean;
use Foswiki::Class qw(app);
extends qw(Foswiki::Object);
with qw(Foswiki::AppObject);

use constant MONITOR => 0;

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}
}

has failure => (
is => 'rw',
clearer => 1,
Expand Down
11 changes: 2 additions & 9 deletions core/lib/Foswiki/Access/AdminOnlyAccess.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,10 @@ use v5.14;

use Assert;

use Moo;
use namespace::clean;
use Foswiki::Class;
extends qw(Foswiki::Access);
use constant MONITOR => 0;

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}
}
use constant MONITOR => 0;

=begin TML
Expand Down
10 changes: 1 addition & 9 deletions core/lib/Foswiki/Access/TopicACLAccess.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,9 @@ use Foswiki ();
use Foswiki::Meta ();
use Foswiki::Users ();

use Moo;
use namespace::clean;
use Foswiki::Class;
extends qw(Foswiki::Access);

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}
}

=begin TML
---++ ObjectMethod haveAccess($mode, $User, $web, $topic, $attachment) -> $boolean
Expand Down
11 changes: 2 additions & 9 deletions core/lib/Foswiki/Access/TopicACLReadOnlyAccess.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,10 @@ use v5.14;

use Assert;

use Moo;
use namespace::clean;
use Foswiki::Class;
extends qw(Foswiki::Access::TopicACLAccess);
use constant MONITOR => 0;

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}
}
use constant MONITOR => 0;

=begin TML
Expand Down
10 changes: 1 addition & 9 deletions core/lib/Foswiki/AccessControlException.pm
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,9 @@ use v5.14;

use Assert;

use Moo;
use namespace::clean;
use Foswiki::Class;
extends qw(Foswiki::Exception);

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}
}

#our @_newParameters = qw( mode user web topic reason );

has web => ( is => 'ro', required => 1, );
Expand Down
12 changes: 2 additions & 10 deletions core/lib/Foswiki/Address.pm
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ use Assert;
use Foswiki::Func();
use Foswiki::Meta();

use Moo;
use namespace::clean;
extends 'Foswiki::Object';
use Foswiki::Class;
extends qw(Foswiki::Object);

#use Data::Dumper;
use constant TRACE => 0; # Don't forget to uncomment dumper
Expand All @@ -76,13 +75,6 @@ use constant TRACEATTACH => 0;
use constant STRINGIFIED_WEB_SEPARATOR => '/';
use constant STRINGIFIED_TOPIC_SEPARATOR => '.';

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}
}

my $EXISTASLIST_DEFAULT = [qw(attachment topic)];
my $EXISTAS_DEFAULT = { attachment => 1, topic => 1 };
my %atomiseAs = (
Expand Down
9 changes: 1 addition & 8 deletions core/lib/Foswiki/AggregateIterator.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,10 @@ Combine multiple iterators into a single iteration.
package Foswiki::AggregateIterator;
use v5.14;

use Moo;
use Foswiki::Class;
extends qw(Foswiki::Object);
with qw(Foswiki::Iterator);

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}
}

=begin TML
---++ new(iterators => \@list, uniqueOnly => $unique)
Expand Down
7 changes: 0 additions & 7 deletions core/lib/Foswiki/Attach.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ use Foswiki qw(expandStandardEscapes);
use Foswiki::Class qw(app);
extends qw(Foswiki::Object);

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}
}

our $MARKER = "\0";

=begin TML
Expand Down
7 changes: 0 additions & 7 deletions core/lib/Foswiki/Attrs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ use strict;
use warnings;
use Assert;

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}
}

# Used in interpolation an regexes, so constant not appropriate
our $MARKER = "\0";

Expand Down
7 changes: 0 additions & 7 deletions core/lib/Foswiki/Compatibility.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ use strict;
use warnings;
use Assert;

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}
}

=begin TML
---+ package Foswiki::Compatibility
Expand Down
3 changes: 2 additions & 1 deletion core/lib/Foswiki/Configure/Checkers/Site/Locale.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package Foswiki::Configure::Checkers::Site::Locale;
use v5.14;

use Moo;
use Foswiki::Class;
extends qw(Foswiki::Configure::Checker);

my @required = (
Expand All @@ -13,6 +13,7 @@ sub check_current_value {
my ( $this, $reporter ) = @_;

if ( $Foswiki::cfg{UseLocale} ) {
$reporter->WARN("POSIX locales are not supported anymore.");
eval("use locale;use POSIX");
if ($@) {
return $this->WARN( 'Locales cannot be used. Error was: '
Expand Down
1 change: 1 addition & 0 deletions core/lib/Foswiki/Configure/Checkers/Store/Encoding.pm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ HERE
}

if ( $Foswiki::cfg{UseLocale} ) {
$reporter->WARN("POSIX locales are not supported anymore.");

# Extract the character set from locale for consistency check
my $charset;
Expand Down
2 changes: 2 additions & 0 deletions core/lib/Foswiki/Configure/Checkers/UseLocale.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ sub check_current_value {

return unless $Foswiki::cfg{UseLocale};

$reporter->WARN("POSIX locales are not supported any more.");

Foswiki::Configure::Dependency::checkPerlModules(@required);
foreach my $mod (@required) {
if ( !$mod->{ok} && !$mod->{optional} ) {
Expand Down
7 changes: 0 additions & 7 deletions core/lib/Foswiki/Engine.pm
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,6 @@ Hashref of headers.

has headers => ( is => 'rw', lazy => 1, builder => '_prepareHeaders', );

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
import locale();
}
}

=begin TML
---++ ClassMethod start(env => \%env)
Expand Down
Loading

0 comments on commit fd070b6

Please sign in to comment.