Keyword brainfart


#1

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


#2

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.

    -jOn 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@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel

jesse reed vincent – root@eruditorum.orgjesse@fsck.com
70EBAC90: 2A07 FC22 7DB4 42C1 9D71 0108 41A3 3FB3 70EB AC90

Pelcgb-serrqbz abj!


#3

Ah. I see now that that’s not outside the last loop and will
decrement the method variable too much…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@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel

jesse reed vincent – root@eruditorum.orgjesse@fsck.com
70EBAC90: 2A07 FC22 7DB4 42C1 9D71 0108 41A3 3FB3 70EB AC90

Any e-mail sent to the SLA will immediately become the intellectual property
of the SLA and the author of said message will enter into a period of
indentured servitude which will last for a period of time no less than seven
years.


#4

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@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel


jesse reed vincent – root@eruditorum.orgjesse@fsck.com
70EBAC90: 2A07 FC22 7DB4 42C1 9D71 0108 41A3 3FB3 70EB AC90

Pelcgb-serrqbz abj!

meow
_ivan