[rt-devel] Keyword brainfart

ivan ivan-rt-devel at 420.am
Mon Apr 2 13:24:13 EDT 2001


my $kids = $Keyword->Descendents($generations && $generations-1, \%results);

On Mon, Apr 02, 2001 at 12:43:37PM -0400, Jesse wrote:
> Um. The problem I ran into which I was trying to fix was that your code
> got confused and decremented generations even when it was supposed
> to stay at "0" - unlimited.  So, I guess, yeah. further explanation
> of what I'm breaking by diddling the instance variable just before
> it's thrown away would be useful...I'm not seeing whatever bug it's causing.
> 
>         -j
> 
> 
> On Mon, Apr 02, 2001 at 09:32:06AM -0700, ivan wrote:
> > Here's an example of why it's a bad idea to fiddle code gratuitously.
> > This should be obvious; let me know if you need further explanation.
> > 
> > Index: Keyword.pm
> > ===================================================================
> > RCS file: /proj/maps/cvsroot/rt/lib/RT/Keyword.pm,v
> > retrieving revision 1.1.2.3
> > retrieving revision 1.12
> > diff -u -b -r1.1.2.3 -r1.12
> > --- Keyword.pm  2001/04/02 16:25:11     1.1.2.3
> > +++ Keyword.pm  2001/03/20 09:13:39     1.12
> > @@ -311,10 +310,7 @@
> >         $results{ $Keyword->id } = $Keyword->Name;
> >                 
> >         if ( $generations == 0 || $generations > 1 ) {
> > -           #if we're limiting to some number of generations,
> > -           # decrement the number of generations
> > -           $generations-- if ( $generations > 1 );
> > -           my $kids = $Keyword->Descendents($generations, \%results);
> > +           my $kids = $Keyword->Descendents($generations-1, \%results);
> >             
> >             foreach my $kid ( keys %{$kids}) {
> >                 $results{"$kid"} = $Keyword->Name. "/". $kids->{"$kid"};
> > 
> > 
> > 
> > 
> > -- 
> > meow
> > _ivan
> > 
> > _______________________________________________
> > Rt-devel mailing list
> > Rt-devel at lists.fsck.com
> > http://lists.fsck.com/mailman/listinfo/rt-devel
> > 
> 
> -- 
> jesse reed vincent -- root at eruditorum.org -- jesse at fsck.com 
> 70EBAC90: 2A07 FC22 7DB4 42C1 9D71 0108 41A3 3FB3 70EB AC90
> 
> Pelcgb-serrqbz abj!

-- 
meow
_ivan




More information about the Rt-devel mailing list