[comp.lang.perl] bug in perl debugger, patch 12

bill@ksr.com (Bill Mann) (03/07/90)

If you use perl debugging mode and have subroutines which return non-array
values, you need the following fix to run under patch 12.  It won't hurt
earlier versions.  Apply like Larry's patches, be sure to use the patch -p
option.  To install, copy lib/perldb.pl into /usr/local/lib/perl (or
whereever if you changed the default).

*** lib/perldb.pl.old	Wed Nov  1 15:28:34 1989
--- lib/perldb.pl	Tue Mar  6 09:12:39 1990
***************
*** 396,410 ****
      }
      push(@sub, $sub . '(' . join(', ', @args) . ') from ' . $line);
      if (wantarray) {
! 	@i = &$sub;
      }
      else {
  	$i = &$sub;
! 	@i = $i;
      }
-     --$#sub;
-     $single |= pop(@stack);
-     @i;
  }
  
  $single = 1;			# so it stops on first executable statement
--- 396,412 ----
      }
      push(@sub, $sub . '(' . join(', ', @args) . ') from ' . $line);
      if (wantarray) {
!         @i = &$sub;
!         --$#sub;
!         $single |= pop(@stack);
!         @i;
      }
      else {
  	$i = &$sub;
!         --$#sub;
!         $single |= pop(@stack);
!         $i;
      }
  }
  
  $single = 1;			# so it stops on first executable statement

Without this patch, running perl -d, all scalar subroutine calls will return
the number 1.

Just another perldb hacker,

Bill Mann
bill@ksr.com (ksr!bill@uunet.uu.net)