Re: Encode doesn't like undef
Dan Kogai <[EMAIL PROTECTED]> 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/
RE: Encode doesn't like undef
Paul Marquess <[EMAIL PROTECTED]> writes: > >I agree that passing undef() to one of the encoding functions may be an edge >condition toois more >common. nick@bactrian 1078$ perl -w -e "print undef" Use of uninitialized value in print at -e line 1. nick@bactrian 1079$ perl -w -e "print $a" Use of uninitialized value in print at -e line 1. nick@bactrian 1080$ perl -w -e '$a =~ tr/A/a/' Name "main::a" used only once: possible typo at -e line 1. Use of uninitialized value in transliteration (tr///) at -e line 1. I agree that passing undef() to print/tr functions may be an edge condition too far, but passing a variable that contains undef is more common. Can this be detected & silenced? Yes it could but we don't for very good reasons. -- Nick Ing-Simmons http://www.ni-s.u-net.com/
Re: Encode doesn't like undef
Paul Marquess <[EMAIL PROTECTED]> writes: >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. You mean you want a different warning? > >Paul -- Nick Ing-Simmons http://www.ni-s.u-net.com/
RE: Encode doesn't like undef
From: Dan Kogai [mailto:[EMAIL PROTECTED]] > 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
Re: Encode doesn't like undef
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. Dan the Encode Maintainer
RE: Encode doesn't like undef
From: Dan Kogai [mailto:[EMAIL PROTECTED]] > 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
Re: Encode doesn't like undef
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. Of course perl5.7.3 -w -MEncode -e 'Encode::encode_utf8("")' is perfectly safe and legal. Dan the Encode Maintainer
Encode doesn't like undef
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. Paul