[Catalyst] TT2 + CP::Authentication + DBIC gotcha

stephen joseph butler stephen.butler at gmail.com
Fri Jul 13 17:14:46 GMT 2007


On 7/13/07, Matt Lawrence <matt.lawrence at ymogen.net> 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;
> }

It doesn't work this way, but suppose you wrote this:

if ($bar) {
  my $vote = $foo
}

Now see why it's wrong? The way you wrote it is kind of ambiguous for
the way we think of postfix operators. If you want something one line,
how about this:

my $vote = $foo ? $bar : undef;



More information about the Catalyst mailing list