develooper Front page | perl.perl5.porters | Postings from June 2008

Re: [perl #36875] [PATCH] scalar reverse undef does not warn (was: Certain string handling functions don't warn on undef)

Thread Previous
From:
Rafael Garcia-Suarez
Date:
June 1, 2008 12:33
Subject:
Re: [perl #36875] [PATCH] scalar reverse undef does not warn (was: Certain string handling functions don't warn on undef)
Message ID:
b77c1dce0806011233s499b05ccjaa858c449bed6c8a@mail.gmail.com
2008/5/24 Bram via RT <perlbug-followup@perl.org>:
> lc, uc, lcfirst and ucfirst already warn in blead.
>
> ./perl -wle 'my $v;$_ = lc $v;$_ = uc $v;$_ = lcfirst $v;$_ = ucfirst
> $v;'
> Use of uninitialized value $v in lc at -e line 1.
> Use of uninitialized value $v in uc at -e line 1.
> Use of uninitialized value $v in lcfirst at -e line 1.
> Use of uninitialized value $v in ucfirst at -e line 1.
>
>
> A patch that adds a warnings for reverse:
>
> ./perl -wle 'my $r1;$_=undef;$_=reverse;$_=reverse $r1;'
> Use of uninitialized value in reverse at -e line 1.
> Use of uninitialized value $r1 in reverse at -e line 1
>
>
> Also in the patch is a test to see that reverse "foo", undef, "bar" warns:
> (this warning was already there, becaues it uses do_join which warns on
> undef, but it wasn't being tested (AFAICT))
>
> ./perl -wle 'my $r1;$_=reverse "foo", $r1, "bar";'
> Use of uninitialized value $r1 in reverse at -e line 1
>
>
> Doesn't warn on:
> ./perl -wle 'my $r1;my @a=reverse "foo", $r1, "bar";'
>
> (which is what I expect)

Thanks, applied as #33981.

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About