From: bharanee rathna Date: Tue, 11 Dec 2007 15:25:21 +0000 (-0800) Subject: [perl #48489] patch to fix perl bug #7013 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1ad62f649328dc563f7f21be3c384f5adf18af1d;p=p5sagit%2Fp5-mst-13.2.git [perl #48489] patch to fix perl bug #7013 From: "bharanee rathna" (via RT) Message-ID: Just the pp_hot.c portion of this patch applied along with removing the TODO from the test added in the previous change. p4raw-id: //depot/perl@34833 --- diff --git a/lib/perl5db.t b/lib/perl5db.t index 22a8271..fd65ef9 100644 --- a/lib/perl5db.t +++ b/lib/perl5db.t @@ -76,9 +76,8 @@ like($contents, qr/sub factorial/, 'The ${main::_ [ '-d' ], progfile => '../lib/perl5db/t/lvalue-bug'); like($output, qr/foo is defined/, 'lvalue subs work in the debugger'); } diff --git a/pp_hot.c b/pp_hot.c index a60a176..fad52aa 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -2774,7 +2774,14 @@ try_autoload: Perl_get_db_sub(aTHX_ &sv, cv); if (CvISXSUB(cv)) PL_curcopdb = PL_curcop; - cv = GvCV(PL_DBsub); + if (CvLVALUE(cv)) { + /* check for lsub that handles lvalue subroutines */ + cv = GvCV(gv_HVadd(gv_fetchpv("DB::lsub", GV_ADDMULTI, SVt_PVHV))); + /* if lsub not found then fall back to DB::sub */ + if (!cv) cv = GvCV(PL_DBsub); + } else { + cv = GvCV(PL_DBsub); + } if (!cv || (!CvXSUB(cv) && !CvSTART(cv))) DIE(aTHX_ "No DB::sub routine defined");