Skip Menu |

This queue is for tickets about the Unicode-Collate CPAN distribution.

Report information
The Basics
Id: 72666
Status: resolved
Priority: 0/
Queue: Unicode-Collate

People
Owner: Nobody in particular
Requestors: contyk [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.86
Fixed in: 0.87

Attachments


Subject: Unicode::Collate::Locale should search for locales in @INC
Locales could be located in a completely different path than the Locale.pm module. The attached patch should fix the behavior by searching all the @INC paths.
Subject: perl-5.14.2-locale-search-inc.patch
diff --git a/cpan/Unicode-Collate/Collate/Locale.pm b/cpan/Unicode-Collate/Collate/Locale.pm index b26db00..35f4fb3 100644 --- a/cpan/Unicode-Collate/Collate/Locale.pm +++ b/cpan/Unicode-Collate/Collate/Locale.pm @@ -8,7 +8,6 @@ our $VERSION = '0.73'; use File::Spec; -(my $ModPath = $INC{'Unicode/Collate/Locale.pm'}) =~ s/\.pm$//; my $PL_EXT = '.pl'; my %LocaleFile = map { ($_, $_) } qw( @@ -56,7 +55,12 @@ sub _fetchpl { my $f = $LocaleFile{$accepted}; return if !$f; $f .= $PL_EXT; - my $path = File::Spec->catfile($ModPath, $f); + my $path; + for my $incpath (@INC) { + $path = File::Spec->catfile($incpath, 'Unicode', 'Collate', 'Locale', $f); + last if -f $path; + $path = undef; + } my $h = do $path; croak "Unicode/Collate/Locale/$f can't be found" if !$h; return $h;
Subject: Re: [rt.cpan.org #72666] Unicode::Collate::Locale should search for locales in @INC
Date: Thu, 24 Nov 2011 21:09:25 +0900
To: bug-Unicode-Collate [...] rt.cpan.org
From: SADAHIRO Tomoyuki <bqw10602 [...] nifty.com>
Show quoted text
> Wed Nov 23 11:42:55 2011: Request 72666 was acted upon. > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=72666 > > > Locales could be located in a completely different path than the > Locale.pm module. The attached patch should fix the behavior by > searching all the @INC paths.
Thanks for your report. Locale.pm could just say my $h = do "Unicode/Collate/Locale/$f"; and would search @INC, since function "do" searches @INC directories. (I guess it should work as your patch.) For me, such a behavior has been intentionally avoided. Why not do so, in other words, why Locale.pm looks for Locale/*.pl under its subdirectory only, is that I'm afraid such a Locale/*.pl in a different path may be unexpected for Locale.pm; for example, older one, wrong one, or .... What situation or purpose, do Locale/*.pl files may be located in a different path than that of Locale.pm? Regards, SADAHIRO Tomoyuki
Subject: Re: [rt.cpan.org #72666] Unicode::Collate::Locale should search for locales in @INC
Date: Thu, 24 Nov 2011 13:28:55 +0100
To: SADAHIRO Tomoyuki via RT <bug-Unicode-Collate [...] rt.cpan.org>
From: Petr Ĺ abata <contyk [...] redhat.com>
On Thu, Nov 24, 2011 at 07:09:51AM -0500, SADAHIRO Tomoyuki via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=72666 > >
> > Wed Nov 23 11:42:55 2011: Request 72666 was acted upon. > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=72666 > > > > > Locales could be located in a completely different path than the > > Locale.pm module. The attached patch should fix the behavior by > > searching all the @INC paths.
> > Thanks for your report. > > Locale.pm could just say > my $h = do "Unicode/Collate/Locale/$f"; > and would search @INC, since function "do" searches @INC directories. > (I guess it should work as your patch.)
Indeed, that would be a lot more elegant. Show quoted text
> For me, such a behavior has been intentionally avoided. > > Why not do so, in other words, > why Locale.pm looks for Locale/*.pl under its subdirectory only, is > that I'm afraid such a Locale/*.pl in a different path may be > unexpected for Locale.pm; for example, older one, wrong one, or ....
That's a valid point. Thank you. Show quoted text
> What situation or purpose, do Locale/*.pl files may be located > in a different path than that of Locale.pm?
We've hit this in Fedora Linux where the module is installed in "/usr/lib" while the locale data are in "/usr/share". This has little benefit and leaves space for the issues you mentioned. It seems this should be fixed in the Fedora package. -- Petr
Download (untitled)
application/pgp-signature 230b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #72666] Unicode::Collate::Locale should search for locales in @INC
Date: Sat, 26 Nov 2011 18:57:35 +0900
To: bug-Unicode-Collate [...] rt.cpan.org
From: SADAHIRO Tomoyuki <bqw10602 [...] nifty.com>
Show quoted text
> > What situation or purpose, do Locale/*.pl files may be located > > in a different path than that of Locale.pm?
> > We've hit this in Fedora Linux where the module is installed in > "/usr/lib" while the locale data are in "/usr/share". > > This has little benefit and leaves space for the issues you > mentioned. It seems this should be fixed in the Fedora package.
It makes sense. I has released a newer version to fix this problem. Thank you, SADAHIRO Tomoyuki