Re: [PATCH] DT::Language alternate namespaces
On Thu, 29 May 2003, Joshua Hoblitt wrote: Uh, they could just call it DT::Language::MyLanguage, right? Do we really want people including DT::Language::* modules in there distributions? If it was something like DT::Language::Custom::Foo, I probably wouldn't care. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: [PATCH] DT::Language alternate namespaces
I just realized that won't allow you specify a top level namespace. Probably not an issue for most people. hmmm... -J -- On Thu, 29 May 2003, Joshua Hoblitt wrote: Dave, Here is a small patch to allow arbitrary namespaces to be passed to DT::Language. This is useful for modules that want to include their own DT::Language subclasses or want to generate information at runtime. Cheers, -J -- Index: lib/DateTime/Language.pm === RCS file: /cvsroot/perl-date-time/modules/DateTime.pm/lib/DateTime/Language.pm,v retrieving revision 1.15 diff -u -r1.15 Language.pm --- lib/DateTime/Language.pm27 Apr 2003 23:40:47 - 1.15 +++ lib/DateTime/Language.pm30 May 2003 00:05:28 - @@ -77,7 +77,14 @@ $real_lang = $lang; } -my $real_class = DateTime::Language::$real_lang; +my $real_class; + +if ( $lang =~ /::/ ) { +$real_class = $lang; +} else { +$real_class = DateTime::Language::$real_lang; +} + eval use $real_class; die $@ if $@; --
Re: [PATCH] DT::Language alternate namespaces
* Joshua Hoblitt ([EMAIL PROTECTED]) [30 May 2003 10:20]: I just realized that won't allow you specify a top level namespace. Probably not an issue for most people. hmmm... More of an issue is that it doesn't complain when one tries. It just silently uses DT::L. +my $real_class; + +if ( $lang =~ /::/ ) { +$real_class = $lang; +} else { +$real_class = DateTime::Language::$real_lang; +} + eval use $real_class; die $@ if $@; cheers, -- Iain.
Re: [PATCH] DT::Language alternate namespaces
On Thu, 29 May 2003, Joshua Hoblitt wrote: Here is a small patch to allow arbitrary namespaces to be passed to DT::Language. This is useful for modules that want to include their own DT::Language subclasses or want to generate information at runtime. Uh, they could just call it DT::Language::MyLanguage, right? Anyway, I want DT::Language to go away soon in favor of DT::Locale. -dave /*=== House Absolute Consulting www.houseabsolute.com ===*/
Re: [PATCH] DT::Language alternate namespaces
Uh, they could just call it DT::Language::MyLanguage, right? Do we really want people including DT::Language::* modules in there distributions? Anyway, I want DT::Language to go away soon in favor of DT::Locale. I know - but it's not here yet. :) -J --
Re: [PATCH] DT::Language alternate namespaces
On Fri, 30 May 2003, Iain Truskett wrote: * Joshua Hoblitt ([EMAIL PROTECTED]) [30 May 2003 10:20]: I just realized that won't allow you specify a top level namespace. Probably not an issue for most people. hmmm... More of an issue is that it doesn't complain when one tries. It just silently uses DT::L. Well if There is no match in DT::L::* then I suppose I could try to see if it is a top level namespace. The draw back is that any error messages about missing modules would be referring to a top level namespace. -J --