Skip Menu |

This queue is for tickets about the Locales CPAN distribution.

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

People
Owner: Nobody in particular
Requestors: ckuskie [...] sterling.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.05
Fixed in: 0.07



Subject: bare use line causes Apache to have fits
For some reason that I don't fully understand, Locales is having problems when used with apache/mod_perl. I wrote a script with this line: use Locales::Country; and got back the following error message: is unsupported, trying en at /usr/local/lib/perl5/site_perl/5.10.0/Locales/Base.pm line 122. Error loading WebGUI::Shop::ShipDriver::UPS: Could not load WebGUI::Shop::ShipDriver::UPS because Unable to loa d ::en : Can't locate /en.pm in @INC (@INC contains: /data/WebGUI/lib /usr/local/lib/perl5/site_perl/5.10.0/i38 6-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread- multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.10.0/i386-linux-thread-mult i /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl . /etc/httpd) at (eval 1099) line 1. Note that there didn't seem to be a locale in there. The same code from a test script worked fine. I had to change the use line to: use Locales::Country qw/ en /; to make it work.
Subject: Re: [rt.cpan.org #46387] bare use line causes Apache to have fits
Date: Tue, 26 May 2009 18:17:48 -0500
To: bug-Locales [...] rt.cpan.org
From: Dan Muey <webmaster [...] simplemood.com>
thanks, I'll have a look ASAP, probably has to do with an eval On May 26, 2009, at 6:05 PM, Colin Kuskie via RT wrote: Show quoted text
> Tue May 26 19:05:44 2009: Request 46387 was acted upon. > Transaction: Ticket created by ckuskie@sterling.net > Queue: Locales > Subject: bare use line causes Apache to have fits > Broken in: 0.05 > Severity: Important > Owner: Nobody > Requestors: ckuskie@sterling.net > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=46387 > > > > For some reason that I don't fully understand, Locales is having > problems when used with apache/mod_perl. > > I wrote a script with this line: > > use Locales::Country; > > and got back the following error message: > > is unsupported, trying en at > /usr/local/lib/perl5/site_perl/5.10.0/Locales/Base.pm line 122. > Error loading WebGUI::Shop::ShipDriver::UPS: Could not load > WebGUI::Shop::ShipDriver::UPS because Unable to loa > d ::en : Can't locate /en.pm in @INC (@INC contains: /data/WebGUI/lib > /usr/local/lib/perl5/site_perl/5.10.0/i38 > 6-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.0 > /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread- > multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl > /usr/lib/perl5/5.10.0/i386-linux-thread-mult > i /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl . /etc/httpd) at > (eval > 1099) line 1. > > Note that there didn't seem to be a locale in there. The same code > from > a test script worked fine. > > I had to change the use line to: > > use Locales::Country qw/ en /; > > to make it work.
Show quoted text
> Locales is having problems when used with apache/mod_perl. > > I wrote a script with this line: > > use Locales::Country; > > and got back the following error message: > > is unsupported, trying en at > /usr/local/lib/perl5/site_perl/5.10.0/Locales/Base.pm line 122. > Unable to load ::en : Can't locate /en.pm in @INC (@INC contains: /data/WebGUI/lib > > I had to change the use line to: > > use Locales::Country qw/ en /; > > to make it work.
It must be an oddity with caller() in a mod_perl environment. What it boils down to is this pseudo example:: my $caller = caller; ... my $module = $caller . "::$locale"; unless ( eval "require $module;" ) { ... What really doesn't make sense is why giving it a locale makes caller() work like you expect. (ultimately resulting in setLocale(), where this is happening, getting passed an argument of 'en' instead of calculating one when no arg is given) I'm new to this module still so please bear with me as I sort through it :) Could you put some debug info logging into your Locales/Base.pm and post the output back here? maybe something like this: sub setLocale { my ($self, $locale) = @_; my $caller = ($self->{_module}) ? $self->{_module} : caller ; use Data::Dumper;$log->debug(Dumper([$caller, [caller()], \@_])); thanks!