[Catalyst] TT2 + CP::Authentication + DBIC gotcha
Andrew Rodland
arodland at comcast.net
Fri Jul 13 17:07:52 GMT 2007
On Friday 13 July 2007 10:33:59 am Matt Lawrence wrote:
> Perrin Harkins wrote:
> > my $vote = $foo if ($bar); # <--- bad!
>
> What's wrong with that? I find it a lot more readable than
>
> my $vote;
> if ($bar) {
> $vote = $foo;
> }
>
Only the fact that it makes perl do Bad Things :)
"my $foo if CONDITION" triggers a bug that lets perl violate the expectation
for the duration of a lexical variable. If the CONDITION is false, $foo
doesn't get undef. It gets a value that's completely unexpected -- unless
you're using it for hack value, but don't do that either :)
Andrew
More information about the Catalyst
mailing list