perl-unicode

RE: Encode doesn't like undef

2002-04-30 09:30:52
From: Dan Kogai [mailto:dankogai(_at_)dan(_dot_)co(_dot_)jp]

On Tuesday, April 30, 2002, at 11:42 , Paul Marquess wrote:
I agree that passing undef() to one of the encoding functions may be an
edge
condition too far, but passing a variable that contains undef is more
common.

$ perl5.7.3 -w -MEncode -e 'Encode::encode_utf8($a)'
Name "main::a" used only once: possible typo at -e line 1.
Use of uninitialized value in subroutine entry at
/tmp/bleed/lib/perl5/5.7.3/sun4-solaris/Encode.pm line 183.

Can this be detected & silenced?

You've got a point.  Warning should warn when and only when there is a
danger therein and passing undef itself is harmless.  And this can be
done easily by adding "defined $str or return;" for each sub concerned.
Okay, I'll go for that.

Yep, I think that's the fix to go for.

Paul