From: Dan Kogai [mailto:[EMAIL PROTECTED]]

> On Wednesday, May 1, 2002, at 02:10 , Nick Ing-Simmons wrote:
> > Dan Kogai <[EMAIL PROTECTED]> writes:
> >
> > Please don't.
> >
> > $a =~ tr/A/a/;
> >
> > gives a warning so should encode/decode.
>
> How can I be so dumb for not anticipating you say that! (Blame it on the
> fever).  Paul, I  now think Nick's got more points than yours so I will
> revert it in the next version.  Maybe I will document this undef-phobia
> of Encode subs in the POD....

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);
  }

Paul

Reply via email to