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

2007-07-14 Thread Jonathan Rockway
On Friday 13 July 2007 02:08:51 pm Christopher Heschong wrote: > What about: > > my $vote = $bar and $foo; > Well, it's the same as: $foo if my $vote = $bar; Which is a useless use of $foo in void context. -- package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do { $,.=reverse q

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

2007-07-13 Thread apv
On Jul 13, 2007, at 8:02 AM, Perrin Harkins wrote: On 7/13/07, apv <[EMAIL PROTECTED]> wrote: [% vote = Catalyst.user.votes({word => w.id}) IF Catalyst.user_exists %] Just FYI, you should never do this type of construct in perl. It will break in bizarre ways. I doubt that's the issue with T

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

2007-07-13 Thread Andrew Rodland
On Friday 13 July 2007 03:59:09 pm Jonathan Swartz wrote: > [my $foo if 0 discussion] > I have the same experience every few years, and I've never been able > to understand why this can't simply be detected and at least flagged > as an error or warning in the Perl compiler. Does anyone know? > > It

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

2007-07-13 Thread Joe Landman
Perrin Harkins wrote: On 7/13/07, J. Shirley <[EMAIL PROTECTED]> wrote: As anecdotal evidence to its insidious behavior, I've personally been involved in a 5 man debugging effort that took 13 days (not full days, but probably an average of 3-4 hours a day * 5 people * 13 days) to finally find th

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

2007-07-13 Thread Jonathan Swartz
On Jul 13, 2007, at 12:13 PM, Perrin Harkins wrote: On 7/13/07, J. Shirley <[EMAIL PROTECTED]> wrote: As anecdotal evidence to its insidious behavior, I've personally been involved in a 5 man debugging effort that took 13 days (not full days, but probably an average of 3-4 hours a day * 5 p

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

2007-07-13 Thread Perrin Harkins
On 7/13/07, J. Shirley <[EMAIL PROTECTED]> wrote: As anecdotal evidence to its insidious behavior, I've personally been involved in a 5 man debugging effort that took 13 days (not full days, but probably an average of 3-4 hours a day * 5 people * 13 days) to finally find the bug. Which was simpl

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

2007-07-13 Thread Christopher Heschong
> On Fri, Jul 13, 2007 at 05:31:53PM +0100, Matt Lawrence wrote: >> stephen joseph butler wrote: >> >On 7/13/07, Matt Lawrence <[EMAIL PROTECTED]> wrote: >> >>Perrin Harkins wrote: >> >>> my $vote = $foo if ($bar); # <--- bad! >> >>> >> >>What's wrong with that? I find it a lot more readable than

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

2007-07-13 Thread J. Shirley
On 7/13/07, Matt Lawrence <[EMAIL PROTECTED]> wrote: Matt S Trout wrote: > On Fri, Jul 13, 2007 at 05:31:53PM +0100, Matt Lawrence wrote: > >> stephen joseph butler wrote: >> >>> On 7/13/07, Matt Lawrence <[EMAIL PROTECTED]> wrote: >>> >> I can't replicate this behaviour. As far as I can tell, th

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

2007-07-13 Thread Matt Lawrence
Matt S Trout wrote: On Fri, Jul 13, 2007 at 05:31:53PM +0100, Matt Lawrence wrote: stephen joseph butler wrote: 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.

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

2007-07-13 Thread Matt S Trout
On Fri, Jul 13, 2007 at 05:31:53PM +0100, Matt Lawrence wrote: > stephen joseph butler wrote: > >On 7/13/07, Matt Lawrence <[EMAIL PROTECTED]> wrote: > >>Perrin Harkins wrote: > >>> my $vote = $foo if ($bar); # <--- bad! > >>> > >>What's wrong with that? I find it a lot more readable than > >> > >

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

2007-07-13 Thread Perrin Harkins
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 quit

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

2007-07-13 Thread Jason Gottshall
stephen joseph butler wrote: > If you want something one line, how about this: > > my $vote = $foo ? $bar : undef; Which might be rendered in TT as: [% vote = foo ? bar : '' %] Since we don't have an explicit undef in TT (yet), I tend to use an empty string; it seems to carry almost all the s

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

2007-07-13 Thread Matt Lawrence
stephen joseph butler wrote: On 7/13/07, Matt Lawrence <[EMAIL PROTECTED]> 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 wr

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

2007-07-13 Thread stephen joseph butler
On 7/13/07, Matt Lawrence <[EMAIL PROTECTED]> 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 $vo

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

2007-07-13 Thread Andrew Rodland
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 $

Use block if, not postfix if [was: Re: [Catalyst] TT2 + CP::Authentication + DBIC gotcha]

2007-07-13 Thread Chisel Wright
On Fri, Jul 13, 2007 at 04:33:59PM +0100, Matt Lawrence wrote: > What's wrong with that? I find it a lot more readable than > > my $vote; > if ($bar) { >$vote = $foo; > } Check chapter 6 in PBP for the reasoning I'd parrot here if I could be bothered to type it all myself. -- Chisel Wright

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

2007-07-13 Thread Matt Lawrence
Perrin Harkins wrote: On 7/13/07, apv <[EMAIL PROTECTED]> wrote: [% vote = Catalyst.user.votes({word => w.id}) IF Catalyst.user_exists %] Just FYI, you should never do this type of construct in perl. It will break in bizarre ways. I doubt that's the issue with TT, but don't get in the habit.

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

2007-07-13 Thread Perrin Harkins
On 7/13/07, apv <[EMAIL PROTECTED]> wrote: [% vote = Catalyst.user.votes({word => w.id}) IF Catalyst.user_exists %] Just FYI, you should never do this type of construct in perl. It will break in bizarre ways. I doubt that's the issue with TT, but don't get in the habit. my $vote = $foo if ($

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

2007-07-13 Thread Bernhard Graf
apv wrote: > This does not: > > [% vote = Catalyst.user.votes({word => w.id}) IF Catalyst.user_exists > %] [% IF vote %] >You rated this “[% vote.rating %]” > [% END %] > > and yields for all cases (and columns): You rated this "" Try [% SET vote = Catalyst.user.votes({word => w.id}) IF Cata

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

2007-07-13 Thread apv
Maybe this is expected behavior (if so, I'd love to know why) and it may give Aristotle a chance to remind us how awful TT2 is (but I keed!), still maybe it's something worth noting. This works: [% IF Catalyst.user_exists %] [% vote = Catalyst.user.votes({word => w.id}) %] [% END %] [% IF