perl-unicode

Re: Encode doesn't like undef

2002-04-30 10:10:46
Dan Kogai <dankogai(_at_)dan(_dot_)co(_dot_)jp> writes:
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.

Please don't.    

$a =~ tr/A/a/; 

gives a warning so should encode/decode.


Dan the Encode Maintainer
-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/



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