perl-unicode

RE: Encode should stay undefphobia

2002-05-01 00:10:46
Paul Marquess <Paul(_dot_)Marquess(_at_)ntlworld(_dot_)com> writes:
Good catch Nick.

Instead of completely backing out the "defined $str or return" change, if
you change it to

  unless (defined $str) {
    warnif('uninitialized', 'Use of Uninitialized value in encode_utf8');
    return;
  }

that gives us the same warning behaviour as print/tr/etc, but more
importantly it also gives users of the module the ability to silence the
uninitalized warning in the same way they do with print/tr, thus:

 use warnings;
 ...
 {
   no warnings 'uninitialized';
   Encode::encode_utf8($x);
 }

But surely the warning we get now is (as a core warning) already so 
controlled ? 

And can we not enhance the message generator to fish the name out 
of somewhere so that is says "Use of undefined in subroutine encode_utf8"
rather than just "subroutine entry" ? 

I would rather do that than litter every .pm module with ops to 
do something that is so generic.



Paul
-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/



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