On 7/13/07, Matt Lawrence <[EMAIL PROTECTED]> wrote:
I can't replicate this behaviour. As far as I can tell, the postfix if
is identical to the block if I wrote above.


perl -Mstrict -wle 'my $foo = 1 if 0; print defined $foo ? $foo : "undef"'
undef


Has the bug been fixed?

No.  Here's a quite from perlsyn:
NOTE: The behaviour of a "my" statement modified with a statement
modifier conditional or loop construct (e.g. "my $x if ...") is
undefined. The value of the "my" variable may be "undef", any
previously assigned value, or possibly anything else. Don't rely on
it. Future versions of perl might do something different from the
version of perl you try it out on. Here be dragons.

There is also a Perl::Critic policy to detect these:
http://search.cpan.org/~thaljef/Perl-Critic-1.06/lib/Perl/Critic/Policy/Variables/ProhibitConditionalDeclarations.pm

- Perrin

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to