Skip Menu |
 

This queue is for tickets about the Locales CPAN distribution.

Report information
The Basics
Id: 34439
Status: resolved
Priority: 0/
Queue: Locales

People
Owner: Nobody in particular
Requestors: andreas.marienborg [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.04
Fixed in: (no value)



Subject: Problems with Locales::Base
Download (untitled) / with headers
text/plain 347b
The problem lies in how strings are interpreted, at least on perl 5.10. "$caller::something" is not $caller . "::something". The included patch fixes this so that fallback works, and also fixes some uninitialized warnings if the _getDefaultLocale returns undef (which it does on my mac os x at least, since none of the ENV variables are set).
Subject: patch.diff
Download patch.diff
text/x-diff 1.5k
--- Base.pm.orig 2008-03-25 13:06:35.000000000 +0100 +++ Base.pm 2008-03-25 13:07:03.000000000 +0100 @@ -46,7 +46,7 @@ { my ($caller) = @_; - my $module = "$caller::$FALLBACK_LOCALE"; + my $module = $caller . "::$FALLBACK_LOCALE"; eval "require $module;" || die "Unable to load $module : $@"; @@ -67,7 +67,6 @@ my $self = {}; my $blessing = bless ( $self, $class ); - if ( $class =~ /::Language/ ) { $self->{_module} = "Locales::Language"; } @@ -98,6 +97,7 @@ $locale ||= _getImportLocale ( $caller ); $locale ||= _getDefaultLocale; +# warn "caller: $caller locale: $locale"; # # check cache: # @@ -115,11 +115,14 @@ my $module = $caller."::$locale"; # print "C/M: $caller/$module\n"; +# warn "module: $module"; + unless ( eval "require $module;" ) { my $defaultLocale = _getDefaultLocale; - if ( $locale eq $defaultLocale ) { - warn ( "$defaultLocale is unsupported, trying $FALLBACK_LOCALE" ); - $object = _loadFallBackLocale; + + if ( !defined($defaultLocale) || $locale eq $defaultLocale ) { + warn ( ($defaultLocale ? $defaultLocale : "undefined") . " is unsupported, trying $FALLBACK_LOCALE" ); + $object = _loadFallBackLocale($caller); } else { warn ( "$locale is unsupported, trying $defaultLocale" ); @@ -136,7 +139,7 @@ } } else { - eval "require $caller::Base" unless ( $LOADS{$caller} ); + eval( "require $caller . '::Base'") unless ( $LOADS{$caller} ); $LOADS{$caller} = 1; # # inheritance wonk, most reference 'new' from base class
Download (untitled) / with headers
text/plain 244b
patch results in: Warning: Use of "require" without parentheses is ambiguous at (eval 18) line 1. the patch works except for that, needs to be: eval( "require $caller . '::Base'") needs to be: eval(qq{require "$caller} . q{::Slurp"})
Subject: Super easy fix for spurious error: Use of uninitialized value in concatenation (.) or string at .../Locales/Base.pm line 139.
Download (untitled) / with headers
text/plain 121b
- eval "require $caller::Base" unless ( $LOADS{$caller} ); + eval "require $caller\::Base" unless ( $LOADS{$caller} );
Download (untitled) / with headers
text/plain 183b
Also the intial patch highlighted this similar issue (but left lots of debug warn in there..) - my $module = "$caller::$FALLBACK_LOCALE"; + my $module = "$caller\::$FALLBACK_LOCALE";
Locales::Base 0.03 addresses this, uploaded to CPAN last night


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.