CGI-Lingua

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for CGI-Lingua

0.85	Thu Aug 27 11:35:33 AM EDT 2026
	[ Bug Fixes ]
	- Data::Validate::IP and NetAddr::IP moved from required to recommended;
	  NetAddr::IP::UtilPP fails to build on Windows (mask4to6 bad-argument error),
	  which cascades to Data::Validate::IP, crashing country() on import; a
	  package-level $_have_dvip sentinel tries to load Data::Validate::IP once and,
	  on failure, installs pure-Perl fallbacks (using Socket::inet_pton for IPv6
	  validation) as aliases for is_ipv4(), is_ipv6(), is_private_ip(), and
	  is_loopback_ip() so the rest of country() is unchanged on both platforms
	- _code2countryname(): when Locale::Object's database is absent, fall back to
	  Locale::Codes::Country::code2country() via the new _country_short_name()
	  helper; a %COUNTRY_SHORT_NAMES table overrides the ~15 codes where
	  Locale::Codes returns the full ISO official name (e.g. "United Kingdom of
	  Great Britain and Northern Ireland") instead of the common short form
	  ("United Kingdom") — fixes sublanguage() returning 'Unknown' for en-gb and

lib/CGI/Lingua.pm  view on Meta::CPAN

Readonly my $GEO_PRESENT         =>  1;               # geo-module sentinel: loaded OK

# Package-level sentinel for Locale::Object's SQLite database.  undef = not yet
# probed; 0 = database absent (Windows installers often omit it); 1 = available.
# Package-level (not per-object) because the database either exists on the
# filesystem or it doesn't — there is no per-request variability.
my $_locale_object_db_ok;

# Package-level sentinel for Data::Validate::IP / NetAddr::IP availability.
# NetAddr::IP::UtilPP fails to build on Windows (mask4to6 bad-argument error),
# which cascades to Data::Validate::IP.  undef = not yet probed; 0 = broken;
# 1 = available.  On first country() call we try to load the module and, if it
# fails, install pure-Perl aliases for the four functions we use.
my $_have_dvip;

# Short-name overrides used when Locale::Object's database is absent and we
# fall back to Locale::Codes::Country.  Locale::Codes carries full ISO official
# names (e.g. "United Kingdom of Great Britain and Northern Ireland") while
# Locale::Object returns the common short form ("United Kingdom").  Only
# entries that differ are listed; everything else comes from Locale::Codes.
my %COUNTRY_SHORT_NAMES = (



( run in 0.711 second using v1.01-cache-2.11-cpan-e7c6538aa59 )