#! /usr/local/bin/perl -w # vim: tabstop=4 # Portable character conversion for Perl. # Copyright (C) 2002-2017 Guido Flohr , # all rights reserved. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # This is a safe wrapper for systems that lack a POSIX shell or have # a too low limit on the length of the command line. use strict; use File::Basename; use Test::Harness; use File::Spec; sub test_harness; my $here = dirname ($0); my $test_dir = $here . '/tests'; my @lib_dirs = ($here . '/blib/lib', $here . '/blib/arch'); local *DIR; opendir DIR, $test_dir or die "cannot open test directory '$test_dir': $!"; @ARGV = sort map $test_dir . '/' . $_, grep /\.t$/, readdir DIR; closedir DIR; eval { require Encode; }; unless ($@) { print "# Encode revision used is $Encode::VERSION.\n"; } test_harness ($ENV{TEST_HARNESS} || 0, @lib_dirs); sub test_harness { $Test::Harness::verbose = shift; local @INC = @INC; unshift @INC, map { File::Spec->rel2abs($_) } @_; my $name = $0; $name =~ s,test\.pl$,xs_disabled,; local *HANDLE; open HANDLE, "<$name" or die "cannot open '$name': $!"; my $xs_disabled = ; close HANDLE; eval { require POSIX; POSIX::setlocale(POSIX::LC_ALL()); }; my $has_locales = !$@; if (!$has_locales) { $xs_disabled = 1; print < ''); unless ($has_de_locale) { require Locale::Util; $has_de_locale = Locale::Util::set_locale (POSIX::LC_ALL(), 'de'); undef $has_de_locale unless ($has_de_locale && $has_de_locale =~ /(?:germany|de)/i); } unless ($has_de_locale) { $xs_disabled = 1; print <