perl-unicode

RE: Encode doesn't like undef

2002-04-30 08:48:45
From: Dan Kogai [mailto:dankogai(_at_)dan(_dot_)co(_dot_)jp]

On Tuesday, April 30, 2002, at 07:14 , Paul Marquess wrote:
This is with Encode 1.64

$ perl5.7.3 -w -MEncode -e 'Encode::encode_utf8(undef)'
Use of uninitialized value in subroutine entry at
/tmp/bleed/lib/perl5/5.7.3/sun4-solaris/Encode.pm line 183.

I don't know Encode well enough to check if there are any other places
this
will strike.

I think we'd better leave that way;  It needs a PV to (en|de)code so
consider this a feature.

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?


Of course

perl5.7.3 -w -MEncode -e 'Encode::encode_utf8("")'

is perfectly safe and legal.

Paul

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