From: Gurusamy Sarathy Date: Fri, 27 Nov 1998 15:12:01 +0000 (+0000) Subject: integrate change#2315 from maint-5.005 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=62f274bf15fc9068424c6964230fb6bf80a54c09;p=p5sagit%2Fp5-mst-13.2.git integrate change#2315 from maint-5.005 p4raw-link: @2315 on //depot/maint-5.005/perl: 7a4920e67d1e2d67a4397a908141c6608866ebb0 p4raw-id: //depot/perl@2327 p4raw-integrated: from //depot/maint-5.005/perl@2326 'ignore' op.c (@2310..) 'merge in' sv.c (@2174..) --- diff --git a/sv.c b/sv.c index 876ef07..95c75da 100644 --- a/sv.c +++ b/sv.c @@ -3902,14 +3902,19 @@ sv_2cv(SV *sv, HV **st, GV **gvp, I32 lref) SV **sp = &sv; /* Used in tryAMAGICunDEREF macro. */ tryAMAGICunDEREF(to_cv); - cv = (CV*)SvRV(sv); - if (SvTYPE(cv) != SVt_PVCV) + sv = SvRV(sv); + if (SvTYPE(sv) == SVt_PVCV) { + cv = (CV*)sv; + *gvp = Nullgv; + *st = CvSTASH(cv); + return cv; + } + else if(isGV(sv)) + gv = (GV*)sv; + else croak("Not a subroutine reference"); - *gvp = Nullgv; - *st = CvSTASH(cv); - return cv; } - if (isGV(sv)) + else if (isGV(sv)) gv = (GV*)sv; else gv = gv_fetchpv(SvPV(sv, PL_na), lref, SVt_PVCV); diff --git a/t/op/sort.t b/t/op/sort.t index aca99a6..df8d434 100755 --- a/t/op/sort.t +++ b/t/op/sort.t @@ -1,6 +1,6 @@ #!./perl -print "1..27\n"; +print "1..29\n"; sub backwards { $a lt $b ? 1 : $a gt $b ? -1 : 0 } @@ -127,6 +127,7 @@ print $@ ? "not ok 21\n# $@" : "ok 21\n"; { my $sortsub = \&backwards; my $sortglob = *backwards; + my $sortglobr = \*backwards; my $sortname = 'backwards'; @b = sort $sortsub 4,1,3,2; print ("@b" eq '4 3 2 1' ? "ok 22\n" : "not ok 22 |@b|\n"); @@ -134,17 +135,22 @@ print $@ ? "not ok 21\n# $@" : "ok 21\n"; print ("@b" eq '4 3 2 1' ? "ok 23\n" : "not ok 23 |@b|\n"); @b = sort $sortname 4,1,3,2; print ("@b" eq '4 3 2 1' ? "ok 24\n" : "not ok 24 |@b|\n"); + @b = sort $sortglobr 4,1,3,2; + print ("@b" eq '4 3 2 1' ? "ok 25\n" : "not ok 25 |@b|\n"); } { local $sortsub = \&backwards; local $sortglob = *backwards; + local $sortglobr = \*backwards; local $sortname = 'backwards'; @b = sort $sortsub 4,1,3,2; - print ("@b" eq '4 3 2 1' ? "ok 25\n" : "not ok 22 |@b|\n"); + print ("@b" eq '4 3 2 1' ? "ok 26\n" : "not ok 26 |@b|\n"); @b = sort $sortglob 4,1,3,2; - print ("@b" eq '4 3 2 1' ? "ok 26\n" : "not ok 23 |@b|\n"); + print ("@b" eq '4 3 2 1' ? "ok 27\n" : "not ok 27 |@b|\n"); @b = sort $sortname 4,1,3,2; - print ("@b" eq '4 3 2 1' ? "ok 27\n" : "not ok 24 |@b|\n"); + print ("@b" eq '4 3 2 1' ? "ok 28\n" : "not ok 28 |@b|\n"); + @b = sort $sortglobr 4,1,3,2; + print ("@b" eq '4 3 2 1' ? "ok 29\n" : "not ok 29 |@b|\n"); }