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

Re: my $foo = "bar" if $baz;

Thread Previous | Thread Next
From:
David Golden
Date:
July 10, 2008 18:30
Subject:
Re: my $foo = "bar" if $baz;
Message ID:
5d4beb40807101830p513eb09cy54901caee608f6e3@mail.gmail.com
On Thu, Jul 10, 2008 at 12:56 PM, Andy Armstrong <andy@hexten.net> wrote:
> There's a thread[1] on the mod_perl mailing list at the moment which
> suggests[2] that
>
> my $foo = "bar" if $baz;
>
> is causing memory corruption with mod_perl on 5.10.0. On 5.8.8 the same code
> worked fine.
>
> It's understood that it's a bad idea but it doesn't seem great that it can
> screw things so badly. Is this a known problem with 5.10?

From perldelta on 5.10.0:

  Deprecated use of my() in false conditional
      A new deprecation warning, *Deprecated use of my() in false
      conditional*, has been added, to warn against the use of the dubious
      and deprecated construct

          my $x if 0;

I'd always heard not to initialize my variables in a conditional statement.

-- David

Thread Previous | Thread Next


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