CGI-Lingua

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

		'DBD::SQLite' => 0,	# Locale::Object doesn't declare this prerequisite
		'Log::Abstraction' => 0.33,	# used by Object::Configure for logger conversion
		'Locale::Object::Country' => 0.78,	# Fix for RT#79214
		'Locale::Object' => 0.80,	# Fix for RT#131347
		'I18N::AcceptLanguage' => 0,
		'Locale::Language' => 0,
		'I18N::LangTags::Detect' => 1.04,
		'Locale::Codes' => 3.59,	# Silence noisy warn messages in perl 5.28
		'Net::Whois::IANA' => 0,
		'Net::Whois::IP' => 0,
		'Object::Configure' => 0.24,
		'Params::Get' => 0.17,	# 0.15 fast-path: unblessed hashref arg returned directly (not stored under default key)
		'Readonly' => 0,
		'Class::Load' => 0,
		'CGI::Info' => 1.14, # For AUTOLOAD
		'Sys::Syslog' => 0,
		'HTTP::BrowserDetect' => 0,
		'Class::Autouse' => 0
    }, dist => $dist,
    clean               => { FILES => 'CGI-Lingua-* t/online.enabled' },
    META_MERGE		=> {
    	'meta-spec' => { version => 2 },
    	optional_features => {
    	    baidu_subnet_detection => {
    	        description => 'Detect Baidu crawler IPs that misreport as EU (RT-86809); not available on Windows due to Socket6 build dependency',
    	        prereqs => { runtime => { recommends => { 'Net::Subnet' => 0 } } },
    	    },
    	    precise_ip_validation => {
    	        description => 'More rigorous IPv6 private-range detection via Data::Validate::IP; not available on Windows because NetAddr::IP (its dep) fails to build there',
    	        prereqs => { runtime => { recommends => { 'Data::Validate::IP' => 0.25, 'NetAddr::IP' => 0 } } },
    	    },
    	    local_time_zone => {
    	        description => 'Detect local time zone via DateTime::TimeZone::Local for time_zone() when running non-CGI (CLI); not available on all Windows Perl builds',
    	        prereqs => { runtime => { recommends => { 'DateTime::TimeZone' => 0 } } },
    	    },
    	}, resources => {
		repository => {
			type => 'git',
			url => 'git://github.com/nigelhorne/CGI-Lingua.git',
			web => 'https://github.com/nigelhorne/CGI-Lingua',
			repository => 'https://github.com/nigelhorne/CGI-Lingua',
		}, bugtracker => {
			url => 'https://rt.cpan.org/Public/Dist/Display.html?Name=CGI-Lingua',
			web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=CGI-Lingua',
			# web => 'https://github.com/nigelhorne/CGI-Lingua/issues',
			# url => 'https://github.com/nigelhorne/CGI-Lingua/issues',
			mailto => 'bug-CGI-Lingua@rt.cpan.org'
		}
	},
    },
	MIN_PERL_VERSION	=> '5.10.1'	# autodie bundled into core from 5.10.1; //= and defined-or used throughout
);

sub are_online
{
	return 0 if($ENV{'NO_NETWORK_TESTING'} || $ENV{'CIRCLECI'} || $ENV{'TRAVIS_PERL_VERSION'} || $ENV{'AUTOMATED_TESTING'} || $ENV{'NONINTERACTIVE_TESTING'} || (!-t STDIN));

	if(my $s = IO::Socket::INET->new(
		# PeerAddr => 'www.ripe.net:43',
		PeerAddr => 'whois.apnic.net:43',
		Timeout => 5
	)) {
		if($ENV{'PERL_MM_USE_DEFAULT'}) {
			close($s);
			return 1;
		}

		# FIXME: should test if any of the modules has been installed
		if((-r '/usr/local/share/GeoIP/GeoIP.dat') ||
		   (-r '/usr/share/GeoIP/GeoIP.dat')) {
			print <<EOF;

You appear to be directly connected to the Internet.  I have some tests
that try to query Whois servers.
These tests will be slow, consider installing IP::Country, Geo::IPfree or
Geo::IP.

EOF
		} else {
			print <<EOF;

You appear to be directly connected to the Internet.  I have some tests
that try to query Whois servers.
These tests will be slow, consider installing either IP::Country or Geo::IPfree.

EOF
		}
		close($s);

		# Timeout inspired by Mail::IMAPClient
		my $rc;
		eval {
			local $SIG{ALRM} = sub { die 'alarm' };
			alarm(60);
			$rc = prompt('Do you want to enable these tests?', 'y') =~ /^y/i ? 1 : 0;
			alarm(0);
		};
		if($@) {
			print "\n";
			return 1;	# The default is 'y'
		}
		return $rc;
	}
	print "On-line tests disabled because I couldn't detect an Internet connexion\n",
		"Consider installing IP::Country, Geo::IPfree or Geo::IP\n";
	return 0;
}



( run in 0.644 second using v1.01-cache-2.11-cpan-364913b4093 )