CGI-Lingua

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

    AUTHOR              => q{Nigel Horne <njh@nigelhorne.com>},
    VERSION_FROM        => 'lib/CGI/Lingua.pm',
    ABSTRACT_FROM       => 'lib/CGI/Lingua.pm',
    ((defined($ExtUtils::MakeMaker::VERSION) &&
     ($ExtUtils::MakeMaker::VERSION >= 6.3002))
      ? ('LICENSE'=> 'GPL')
      : ()),
	PL_FILES	=> {}, CONFIGURE_REQUIRES => {
		'ExtUtils::MakeMaker' => 6.64,	# Minimum version for TEST_REQUIRES
    }, TEST_REQUIRES => $test_requires,
    PREREQ_PM => {
	'DBD::SQLite' => 0,	# Locale::Object doesn't declare this prerequisite
	'ExtUtils::MakeMaker' => 6.64,	# Minimum version for TEST_REQUIRES
	'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,
	'Data::Validate::IP' => 0.25,	# For is_private_ip
	'Locale::Codes' => 3.59,	# Silence noisy warn messages in perl 5.28
	'Net::Whois::IANA' => 0,
	'Net::Whois::IP' => 0,
	'NetAddr::IP' => 0,
	'Object::Configure' => 0.14,
	'Params::Get' => 0.13,
	'Class::Load' => 0,
	'CGI::Info' => 0.60, # For AUTOLOAD
	'Sys::Syslog' => 0,
	'HTTP::BrowserDetect' => 0,
	'Net::Subnet' => 0,
	'Class::Autouse' => 0
    }, dist => $dist,
    clean               => { FILES => 'CGI-Lingua-* t/online.enabled' },
    META_MERGE		=> {
    	'meta-spec' => { version => 2 },
    	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.6.2'	# Probably would work, but never tested on earlier versions than this
);

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 2.604 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )