3 * Copyright (c) 1991-1994, Larry Wall
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
11 * 'Mercy!' cried Gandalf. 'If the giving of information is to be the cure
12 * of your inquisitiveness, I shall spend all the rest of my days answering
13 * you. What more do you want to know?'
14 * 'The names of all the stars, and of all living things, and the whole
15 * history of Middle-earth and Over-heaven and of the Sundering Seas,'
28 if (!gv || SvTYPE((SV*)gv) != SVt_PVGV)
29 croak("Bad symbol for array");
39 if (!gv || SvTYPE((SV*)gv) != SVt_PVGV)
40 croak("Bad symbol for hash");
50 if (!gv || SvTYPE((SV*)gv) != SVt_PVGV)
51 croak("Bad symbol for filehandle");
64 sprintf(tmpbuf,"::_<%s", name);
65 gv = gv_fetchpv(tmpbuf, TRUE, SVt_PVGV);
66 sv_setpv(GvSV(gv), name);
67 if (*name == '/' && (instr(name,"/lib/") || instr(name,".pm")))
70 hv_magic(GvHVn(gv_AVadd(gv)), gv, 'L');
75 gv_init(gv, stash, name, len, multi)
84 sv_upgrade((SV*)gv, SVt_PVGV);
88 GvGP(gv) = gp_ref(gp);
90 GvSV(gv) = NEWSV(72,0);
91 GvLINE(gv) = curcop->cop_line;
92 GvFILEGV(gv) = curcop->cop_filegv;
94 sv_magic((SV*)gv, (SV*)gv, '*', name, len);
96 GvNAME(gv) = savepvn(name, len);
103 gv_init_sv(gv, sv_type)
121 gv_fetchmeth(stash, name, len, level)
137 croak("Recursive inheritance detected");
139 gvp = (GV**)hv_fetch(stash, name, len, TRUE);
141 DEBUG_o( deb("Looking for method %s in package %s\n",name,HvNAME(stash)) );
143 if (SvTYPE(topgv) != SVt_PVGV)
144 gv_init(topgv, stash, name, len, TRUE);
146 if (cv=GvCV(topgv)) {
147 if (GvCVGEN(topgv) >= sub_generation)
148 return topgv; /* valid cached inheritance */
149 if (!GvCVGEN(topgv)) { /* not an inheritance cache */
153 /* stale cached entry, just junk it */
154 GvCV(topgv) = cv = 0;
158 /* if cv is still set, we have to free it if we find something to cache */
160 gvp = (GV**)hv_fetch(stash,"ISA",3,FALSE);
161 if (gvp && (gv = *gvp) != (GV*)&sv_undef && (av = GvAV(gv))) {
162 SV** svp = AvARRAY(av);
163 I32 items = AvFILL(av) + 1;
166 HV* basestash = gv_stashsv(sv, FALSE);
169 warn("Can't locate package %s for @%s::ISA",
170 SvPVX(sv), HvNAME(stash));
173 gv = gv_fetchmeth(basestash, name, len, level + 1);
175 if (cv) { /* junk old undef */
176 assert(SvREFCNT(topgv) > 1);
180 GvCV(topgv) = GvCV(gv); /* cache the CV */
181 GvCVGEN(topgv) = sub_generation; /* valid for now */
188 if (lastchance = gv_stashpvn("UNIVERSAL", 9, FALSE)) {
189 if (gv = gv_fetchmeth(lastchance, name, len, level + 1)) {
190 if (cv) { /* junk old undef */
191 assert(SvREFCNT(topgv) > 1);
195 GvCV(topgv) = GvCV(gv); /* cache the CV */
196 GvCVGEN(topgv) = sub_generation; /* valid for now */
206 gv_fetchmethod(stash, name)
214 for (nend = name; *nend; nend++) {
215 if (*nend == ':' || *nend == '\'')
220 char *origname = name;
226 if (strEQ(origname,"SUPER")) {
227 /* Degenerate case ->SUPER::method should really lookup in original stash */
228 SV *tmpstr = sv_2mortal(newSVpv(HvNAME(curcop->cop_stash),0));
229 sv_catpvn(tmpstr, "::SUPER", 7);
230 stash = gv_stashpvn(SvPVX(tmpstr),SvCUR(tmpstr),TRUE);
232 DEBUG_o( deb("Treating %s as %s::%s\n",origname,HvNAME(stash),name) );
234 stash = gv_stashpvn(origname, nsplit - origname, TRUE);
238 gv = gv_fetchmeth(stash, name, nend - name, 0);
241 /* Failed obvious case - look for SUPER as last element of stash's name */
242 char *packname = HvNAME(stash);
243 STRLEN len = strlen(packname);
244 if (len >= 7 && strEQ(packname+len-7,"::SUPER")) {
245 /* Now look for @.*::SUPER::ISA */
246 GV** gvp = (GV**)hv_fetch(stash,"ISA",3,FALSE);
248 if (!gvp || (gv = *gvp) == (GV*)&sv_undef || !GvAV(gv)) {
249 /* No @ISA in package ending in ::SUPER - drop suffix
250 and see if there is an @ISA there
253 char ch = packname[len];
255 packname[len] = '\0';
256 basestash = gv_stashpvn(packname, len, TRUE);
258 gvp = (GV**)hv_fetch(basestash,"ISA",3,FALSE);
259 if (gvp && (gv = *gvp) != (GV*)&sv_undef && (av = GvAV(gv))) {
260 /* Okay found @ISA after dropping the SUPER, alias it */
261 SV *tmpstr = sv_2mortal(newSVpv(HvNAME(stash),0));
262 sv_catpvn(tmpstr, "::ISA", 5);
263 gv = gv_fetchpv(SvPV(tmpstr,na),TRUE,SVt_PVGV);
265 GvAV(gv) = (AV*)SvREFCNT_inc(av);
266 /* ... and re-try lookup */
267 gv = gv_fetchmeth(stash, name, nend - name, 0);
269 croak("Cannot create %s::ISA",HvNAME(stash));
279 if (strEQ(name,"import") || strEQ(name,"unimport"))
281 else if (strNE(name, "AUTOLOAD")) {
282 gv = gv_fetchmeth(stash, "AUTOLOAD", 8, 0);
283 if (gv && (cv = GvCV(gv))) { /* One more chance... */
284 SV *tmpstr = sv_2mortal(newSVpv(HvNAME(stash),0));
285 sv_catpvn(tmpstr,"::", 2);
286 sv_catpvn(tmpstr, name, nend - name);
287 sv_setsv(GvSV(CvGV(cv)), tmpstr);
289 sv_unmagic(GvSV(CvGV(cv)), 't');
297 gv_stashpv(name,create)
301 return gv_stashpvn(name, strlen(name), create);
305 gv_stashpvn(name,namelen,create)
314 if (namelen > 1200) {
317 warn("Weird package name \"%s\" truncated", name);
319 warn("Weird package name \"%.*s...\" truncated", namelen, name);
322 Copy(name,tmpbuf,namelen,char);
323 tmpbuf[namelen++] = ':';
324 tmpbuf[namelen++] = ':';
325 tmpbuf[namelen] = '\0';
326 tmpgv = gv_fetchpv(tmpbuf,create, SVt_PVHV);
330 GvHV(tmpgv) = newHV();
333 HvNAME(stash) = savepv(name);
338 gv_stashsv(sv,create)
345 return gv_stashpvn(ptr, len, create);
350 gv_fetchpv(nambeg,add,sv_type)
355 register char *name = nambeg;
359 register char *namend;
364 if (*name == '*' && isALPHA(name[1])) /* accidental stringify on a GV? */
367 for (namend = name; *namend; namend++) {
368 if ((*namend == '\'' && namend[1]) ||
369 (*namend == ':' && namend[1] == ':'))
373 if (!stash || !SvREFCNT(stash)) /* symbol table under destruction */
378 New(601, tmpbuf, len+3, char);
379 Copy(name, tmpbuf, len, char);
383 gvp = (GV**)hv_fetch(stash,tmpbuf,len,add);
385 if (!gvp || *gvp == (GV*)&sv_undef)
389 if (SvTYPE(gv) == SVt_PVGV)
394 gv_init(gv, stash, nambeg, namend - nambeg, (add & 2));
396 if (!(stash = GvHV(gv)))
397 stash = GvHV(gv) = newHV();
400 HvNAME(stash) = savepvn(nambeg, namend - nambeg);
408 return gv ? gv : (GV*)*hv_fetch(defstash, "main::", 6, TRUE);
415 /* No stash in name, so see how we can default */
418 if (isIDFIRST(*name)) {
419 if (isUPPER(*name)) {
421 if (*name == 'S' && (
422 strEQ(name, "SIG") ||
423 strEQ(name, "STDIN") ||
424 strEQ(name, "STDOUT") ||
425 strEQ(name, "STDERR") ))
428 else if (*name > 'E') {
429 if (*name == 'I' && strEQ(name, "INC"))
432 else if (*name > 'A') {
433 if (*name == 'E' && strEQ(name, "ENV"))
436 else if (*name == 'A' && (
437 strEQ(name, "ARGV") ||
438 strEQ(name, "ARGVOUT") ))
441 else if (*name == '_' && !name[1])
445 else if ((COP*)curcop == &compiling) {
447 if (add && (hints & HINT_STRICT_VARS) &&
448 sv_type != SVt_PVCV &&
449 sv_type != SVt_PVGV &&
450 sv_type != SVt_PVFM &&
451 sv_type != SVt_PVIO &&
452 !(len == 1 && sv_type == SVt_PV && strchr("ab",*name)) )
454 gvp = (GV**)hv_fetch(stash,name,len,0);
456 *gvp == (GV*)&sv_undef ||
457 SvTYPE(*gvp) != SVt_PVGV)
461 else if (sv_type == SVt_PV && !GvIMPORTED_SV(*gvp) ||
462 sv_type == SVt_PVAV && !GvIMPORTED_AV(*gvp) ||
463 sv_type == SVt_PVHV && !GvIMPORTED_HV(*gvp) )
465 warn("Variable \"%c%s\" is not imported",
466 sv_type == SVt_PVAV ? '@' :
467 sv_type == SVt_PVHV ? '%' : '$',
470 warn("(Did you mean &%s instead?)\n", name);
476 stash = curcop->cop_stash;
482 /* By this point we should have a stash and a name */
486 warn("Global symbol \"%s\" requires explicit package name", name);
488 stash = curstash ? curstash : defstash; /* avoid core dumps */
494 if (!SvREFCNT(stash)) /* symbol table under destruction */
497 gvp = (GV**)hv_fetch(stash,name,len,add);
498 if (!gvp || *gvp == (GV*)&sv_undef)
501 if (SvTYPE(gv) == SVt_PVGV) {
504 gv_init_sv(gv, sv_type);
509 /* Adding a new symbol */
512 warn("Had to create %s unexpectedly", nambeg);
513 gv_init(gv, stash, name, len, add & 2);
514 gv_init_sv(gv, sv_type);
516 /* set up magic where warranted */
519 if (strEQ(name, "ARGV")) {
520 IoFLAGS(GvIOn(gv)) |= IOf_ARGV|IOf_START;
530 if (strnEQ(name, "EXPORT", 6))
534 if (strEQ(name, "ISA")) {
537 sv_magic((SV*)av, (SV*)gv, 'I', Nullch, 0);
538 if (add & 2 && strEQ(nambeg,"AnyDBM_File::ISA") && AvFILL(av) == -1)
541 av_push(av, newSVpv(pname = "NDBM_File",0));
542 gv_stashpvn(pname, 9, TRUE);
543 av_push(av, newSVpv(pname = "DB_File",0));
544 gv_stashpvn(pname, 7, TRUE);
545 av_push(av, newSVpv(pname = "GDBM_File",0));
546 gv_stashpvn(pname, 9, TRUE);
547 av_push(av, newSVpv(pname = "SDBM_File",0));
548 gv_stashpvn(pname, 9, TRUE);
549 av_push(av, newSVpv(pname = "ODBM_File",0));
550 gv_stashpvn(pname, 9, TRUE);
556 if (strEQ(name, "OVERLOAD")) {
559 sv_magic((SV*)hv, (SV*)gv, 'A', 0, 0);
562 #endif /* OVERLOAD */
564 if (strEQ(name, "SIG")) {
570 hv_magic(hv, siggv, 'S');
571 for(i=1;sig_name[i];i++) {
573 init=hv_fetch(hv,sig_name[i],strlen(sig_name[i]),1);
575 sv_setsv(*init,&sv_undef);
579 /* initialize signal stack */
580 signalstack = newAV();
581 AvREAL_off(signalstack);
582 av_extend(signalstack, 30);
583 av_fill(signalstack, 0);
611 sv_setpv(GvSV(gv),chopset);
616 if (dowarn && len == 1 && sv_type == SVt_PV)
617 warn("Use of $%s is deprecated", name);
661 SvREADONLY_on(GvSV(gv));
663 sv_magic(GvSV(gv), (SV*)gv, 0, name, len);
669 sv_setpv(GvSV(gv),"\f");
675 sv_setpv(GvSV(gv),"\034");
681 sv_upgrade(sv, SVt_PVNV);
682 sv_setpv(sv, patchlevel);
690 gv_fullname(sv, gv, prefix)
695 HV *hv = GvSTASH(gv);
700 sv_setpv(sv, prefix ? prefix : "");
701 sv_catpv(sv,HvNAME(hv));
702 sv_catpvn(sv,"::", 2);
703 sv_catpvn(sv,GvNAME(gv),GvNAMELEN(gv));
707 gv_efullname(sv, gv, prefix)
715 gv_fullname(sv, egv, prefix);
724 io = (IO*)NEWSV(0,0);
725 sv_upgrade((SV *)io,SVt_PVIO);
728 iogv = gv_fetchpv("IO::Handle::", TRUE, SVt_PVHV);
729 SvSTASH(io) = (HV*)SvREFCNT_inc(GvHV(iogv));
745 for (i = 0; i <= (I32) HvMAX(stash); i++) {
746 for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) {
747 if (HeKEY(entry)[HeKLEN(entry)-1] == ':' &&
748 (gv = (GV*)HeVAL(entry)) && (hv = GvHV(gv)) && HvNAME(hv))
751 gv_check(hv); /* nested package */
753 else if (isALPHA(*HeKEY(entry))) {
754 gv = (GV*)HeVAL(entry);
757 curcop->cop_line = GvLINE(gv);
758 filegv = GvFILEGV(gv);
759 curcop->cop_filegv = filegv;
760 if (filegv && GvMULTI(filegv)) /* Filename began with slash */
762 warn("Name \"%s::%s\" used only once: possible typo",
763 HvNAME(stash), GvNAME(gv));
773 (void)sprintf(tokenbuf,"%s::_GEN_%ld",pack,(long)gensym++);
774 return gv_fetchpv(tokenbuf,TRUE, SVt_PVGV);
777 /* hopefully this is only called on local symbol table entries */
795 if (!gv || !(gp = GvGP(gv)))
797 if (gp->gp_refcnt == 0) {
798 warn("Attempt to free unreferenced glob pointers");
801 if (--gp->gp_refcnt > 0) {
802 if (gp->gp_egv == gv)
807 SvREFCNT_dec(gp->gp_sv);
808 SvREFCNT_dec(gp->gp_av);
809 SvREFCNT_dec(gp->gp_hv);
810 SvREFCNT_dec(gp->gp_io);
811 if ((cv = gp->gp_cv) && !GvCVGEN(gv))
813 SvREFCNT_dec(gp->gp_form);
819 #if defined(CRIPPLED_CC) && (defined(iAPX286) || defined(M_I286) || defined(I80286))
823 #ifdef MICROPORT /* Microport 2.4 hack */
828 return GvGP(gv)->gp_av;
830 return GvGP(gv_AVadd(gv))->gp_av;
837 return GvGP(gv)->gp_hv;
839 return GvGP(gv_HVadd(gv))->gp_hv;
841 #endif /* Microport 2.4 hack */
844 /* Updates and caches the CV's */
854 MAGIC* mg=mg_find((SV*)stash,'c');
855 AMT *amtp=mg ? (AMT*)mg->mg_ptr: NULL;
857 if (mg && (amtp=((AMT*)(mg->mg_ptr)))->was_ok_am == amagic_generation &&
858 amtp->was_ok_sub == sub_generation)
859 return HV_AMAGIC(stash)? TRUE: FALSE;
860 gvp=(GV**)hv_fetch(stash,"OVERLOAD",8,FALSE);
861 if (amtp && amtp->table) {
863 for (i=1;i<NofAMmeth*2;i++) {
864 if (amtp->table[i]) {
865 SvREFCNT_dec(amtp->table[i]);
869 sv_unmagic((SV*)stash, 'c');
871 DEBUG_o( deb("Recalcing overload magic in package %s\n",HvNAME(stash)) );
873 if (gvp && ((gv = *gvp) != (GV*)&sv_undef && (hv = GvHV(gv)))) {
882 /* if (*(svp)==(SV*)amagic_generation && *(svp+1)==(SV*)sub_generation) {
883 DEBUG_o( deb("Overload magic in package %s up-to-date\n",HvNAME(stash))
885 return HV_AMAGIC(stash)? TRUE: FALSE;
888 amt.was_ok_am=amagic_generation;
889 amt.was_ok_sub=sub_generation;
890 amt.fallback=AMGfallNO;
892 /* Work with "fallback" key, which we assume to be first in AMG_names */
894 if ((cp=((char**)(*AMG_names))[0]) &&
895 (svp=(SV**)hv_fetch(hv,cp,strlen(cp),FALSE)) && (sv = *svp)) {
896 if (SvTRUE(sv)) amt.fallback=AMGfallYES;
897 else if (SvOK(sv)) amt.fallback=AMGfallNEVER;
900 for (i=1;i<NofAMmeth*2;i++) {
903 if ( (cp=((char**)(*AMG_names))[i]) ) {
904 svp=(SV**)hv_fetch(hv,cp,strlen(cp),FALSE);
905 if (svp && ((sv = *svp) != &sv_undef)) {
906 switch (SvTYPE(sv)) {
909 if (!SvOK(sv)) break;
910 gv = gv_fetchmethod(stash, SvPV(sv, na));
911 if (gv) cv = GvCV(gv);
915 if (SvTYPE(cv) == SVt_PVCV)
920 die("Not a subroutine reference in %%OVERLOAD");
926 if (!(cv = GvCV((GV*)sv)))
927 cv = sv_2cv(sv, &stash, &gv, TRUE);
932 die("Method for operation %s not found in package %.256s during blessing\n",
938 amt.table[i]=(CV*)SvREFCNT_inc(cv);
940 sv_magic((SV*)stash, 0, 'c', (char*)&amt, sizeof(amt));
942 /* HV_badAMAGIC_off(stash);*/
947 /*HV_badAMAGIC_off(stash);*/
948 HV_AMAGIC_off(stash);
952 /* During call to this subroutine stack can be reallocated. It is
953 * advised to call SPAGAIN macro in your code after call */
956 amagic_call(left,right,method,flags)
964 CV **cvp=NULL, **ocvp=NULL;
966 int fl=0, off, off1, lr=0, assign=AMGf_assign & flags, notfound=0;
967 int postpr=0, inc_dec_ass=0, assignshift=assign?1:0;
969 if (!(AMGf_noleft & flags) && SvAMAGIC(left)
970 && (mg = mg_find((SV*)(stash=SvSTASH(SvRV(left))),'c'))
971 && (ocvp = cvp = ((oamtp=amtp=(AMT*)mg->mg_ptr)->table))
972 && ((cv = cvp[off=method+assignshift])
973 || (assign && amtp->fallback > AMGfallNEVER && /* fallback to
975 (fl = 1, cv = cvp[off=method])))) {
976 lr = -1; /* Call method for left argument */
978 if (cvp && amtp->fallback > AMGfallNEVER && flags & AMGf_unary) {
981 /* look for substituted methods */
984 if (((cv = cvp[off=add_ass_amg]) && (inc_dec_ass=1))
985 || ((cv = cvp[off=add_amg]) && (postpr=1))) {
986 right = &sv_yes; lr = -1; assign = 1;
990 if (((cv = cvp[off=subtr_ass_amg]) && (inc_dec_ass=1))
991 || ((cv = cvp[off=subtr_amg]) && (postpr=1))) {
992 right = &sv_yes; lr = -1; assign = 1;
996 (void)((cv = cvp[off=numer_amg]) || (cv = cvp[off=string_amg]));
999 (void)((cv = cvp[off=string_amg]) || (cv = cvp[off=bool__amg]));
1002 (void)((cv = cvp[off=numer_amg]) || (cv = cvp[off=bool__amg]));
1005 (void)((cv = cvp[off=bool__amg])
1006 || (cv = cvp[off=numer_amg])
1007 || (cv = cvp[off=string_amg]));
1013 if (!SvROK(ref) && SvTYPE(ref) <= SVt_PVMG) { /* Just to be
1020 SV* newref = newSVsv(ref);
1021 SvOBJECT_on(newref);
1022 SvSTASH(newref) = (HV*)SvREFCNT_inc(SvSTASH(ref));
1028 if ((cvp[off1=lt_amg] || cvp[off1=ncmp_amg])
1029 && ((cv = cvp[off=neg_amg]) || (cv = cvp[off=subtr_amg]))) {
1030 SV* nullsv=sv_2mortal(newSViv(0));
1032 SV* lessp = amagic_call(left,nullsv,
1033 lt_amg,AMGf_noright);
1034 logic = SvTRUE(lessp);
1036 SV* lessp = amagic_call(left,nullsv,
1037 ncmp_amg,AMGf_noright);
1038 logic = (SvNV(lessp) < 0);
1041 if (off==subtr_amg) {
1052 if (cv = cvp[off=subtr_amg]) {
1054 left = sv_2mortal(newSViv(0));
1061 if (!cv) goto not_found;
1062 } else if (!(AMGf_noright & flags) && SvAMAGIC(right)
1063 && (mg = mg_find((SV*)(stash=SvSTASH(SvRV(right))),'c'))
1064 && (cvp = ((amtp=(AMT*)mg->mg_ptr)->table))
1065 && (cv = cvp[off=method])) { /* Method for right
1068 } else if (((ocvp && oamtp->fallback > AMGfallNEVER
1069 && (cvp=ocvp) && (lr = -1))
1070 || (cvp && amtp->fallback > AMGfallNEVER && (lr=1)))
1071 && !(flags & AMGf_unary)) {
1072 /* We look for substitution for
1073 * comparison operations and
1075 if (method==concat_amg || method==concat_ass_amg
1076 || method==repeat_amg || method==repeat_ass_amg) {
1077 return NULL; /* Delegate operation to string conversion */
1087 postpr = 1; off=ncmp_amg; break;
1094 postpr = 1; off=scmp_amg; break;
1096 if (off != -1) cv = cvp[off];
1101 not_found: /* No method found, either report or die */
1102 if (ocvp && (cv=ocvp[nomethod_amg])) { /* Call report method */
1103 notfound = 1; lr = -1;
1104 } else if (cvp && (cv=cvp[nomethod_amg])) {
1105 notfound = 1; lr = 1;
1107 if (off==-1) off=method;
1108 sprintf(buf, "Operation `%s': no method found,\n\tleft argument %s%.256s,\n\tright argument %s%.256s",
1109 ((char**)AMG_names)[method + assignshift],
1111 "in overloaded package ":
1112 "has no overloaded magic",
1114 HvNAME(SvSTASH(SvRV(left))):
1117 "in overloaded package ":
1118 "has no overloaded magic",
1120 HvNAME(SvSTASH(SvRV(right))):
1122 if (amtp && amtp->fallback >= AMGfallYES) {
1123 DEBUG_o( deb(buf) );
1132 DEBUG_o( deb("Overloaded operator `%s'%s%s%s:\n\tmethod%s found%s in package %.256s%s\n",
1133 ((char**)AMG_names)[off],
1134 method+assignshift==off? "" :
1136 method+assignshift==off? "" :
1137 ((char**)AMG_names)[method+assignshift],
1138 method+assignshift==off? "" : "')",
1139 flags & AMGf_unary? "" :
1140 lr==1 ? " for right argument": " for left argument",
1141 flags & AMGf_unary? " for argument" : "",
1143 fl? ",\n\tassignment variant used": "") );
1144 /* Since we use shallow copy during assignment, we need
1145 * to dublicate the contents, probably calling user-supplied
1146 * version of copy operator
1148 if ((method + assignshift==off
1149 && (assign || method==inc_amg || method==dec_amg))
1150 || inc_dec_ass) RvDEEPCP(left);
1157 Zero(&myop, 1, BINOP);
1158 myop.op_last = (OP *) &myop;
1159 myop.op_next = Nullop;
1160 myop.op_flags = OPf_KNOW|OPf_STACKED;
1165 if (perldb && curstash != debstash)
1166 op->op_private |= OPpENTERSUB_DB;
1170 EXTEND(sp, notfound + 5);
1171 PUSHs(lr>0? right: left);
1172 PUSHs(lr>0? left: right);
1173 PUSHs( assign ? &sv_undef : (lr>0? &sv_yes: &sv_no));
1175 PUSHs( sv_2mortal(newSVpv(((char**)AMG_names)[method + assignshift],0)) );
1180 if (op = pp_entersub())
1189 /* sv_2mortal(res); */
1198 ans=SvIV(res)<=0; break;
1201 ans=SvIV(res)<0; break;
1204 ans=SvIV(res)>=0; break;
1207 ans=SvIV(res)>0; break;
1210 ans=SvIV(res)==0; break;
1213 ans=SvIV(res)!=0; break;
1216 SvSetSV(left,res); return res; break;
1218 ans=!SvOK(res); break;
1220 return ans? &sv_yes: &sv_no;
1221 } else if (method==copy_amg) {
1223 die("Copy method did not return a reference");
1225 return SvREFCNT_inc(SvRV(res));
1231 #endif /* OVERLOAD */