perl-unicode

Re: Encode API

2002-04-11 05:33:24
Daisuke Maki <daisuke(_at_)wafu(_dot_)ne(_dot_)jp> writes:
What's wrong with

  use Encode ();

?

I do realize it's a style issue. I don't feel particularly strongly 
about this, but it just seems odd that a core module would do this.

I am afraid it is legacy from its brief life as a sub-module of Tk.
Not exporting anything by default, or just find_encoding would be 
fine by me as I tend to use it thus:

my $enc = find_encoding(...);
my $now = $enc->encode(...);

I find the "in-place" from_to() API clumsy and even the order of the args 
odd.  I would like to have been able to write 

   if ($now = from_to(iso8859_1 => utf8 => $string)) 

But of course it has to be 
   if (from_to(my $now = $string,  iso8859_1 => 'utf8')
    


Anyway, my point is that I just shudder at the thought of modules 
polluting my namespace by default in general. But I guess if you're 
going to take the "What's wrong with use Encode()" atitude ( which is 
fine, just not my style ), I guess there isn't much to go on for me. ;)

que sera sera
--d
-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/



<Prev in Thread] Current Thread [Next in Thread>