summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sv.c b/sv.c
index 876ef0785d..95c75da355 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);