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

J. Shirley jshirley at gmail.com
Fri Jul 13 19:38:18 GMT 2007


On 7/13/07, Matt Lawrence <matt.lawrence at ymogen.net> 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 <matt.lawrence at ymogen.net> 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, because people use the "if 0" construct as a way to create a static.
> >
> > cain$ re.pl
> > $ sub foo { my $foo if 0; $foo++; }
> > $ foo();
> > 0                                                                               $ foo();
> > 1                                                                               $ foo();
> > 2                                                                               $
> >
>
> Eurgh. I've never seen that before, but it's horrible.
>
> Matt
>
>
>

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 simply "my $foo = $bar if $baz;"

The reason why it was so hard to track down was because ot he
wonderful undefined behavior.

Ahh, good times.  Never use that construct, for it will hurt you.  At
least we were all on billable hours ;)

-Jay

-- 
J. Shirley :: jshirley at gmail.com :: Killing two stones with one bird...
http://www.toeat.com



More information about the Catalyst mailing list