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) >= 0 && strEQ(packname+len,"::SUPER")) {
245 /* Now look for @.*::SUPER::ISA */
246 GV** gvp = (GV**)hv_fetch(stash,"ISA",3,FALSE);
247 if (!gvp || (gv = *gvp) == (GV*)&sv_undef || !GvAV(gv)) {
248 /* No @ISA in package ending in ::SUPER - drop suffix
249 and see if there is an @ISA there
252 char ch = packname[len];
254 packname[len] = '\0';
255 basestash = gv_stashpvn(packname, len, TRUE);
257 gvp = (GV**)hv_fetch(basestash,"ISA",3,FALSE);
258 if (gvp && (gv = *gvp) != (GV*)&sv_undef && (av = GvAV(gv))) {
259 /* Okay found @ISA after dropping the SUPER, alias it */
260 SV *tmpstr = sv_2mortal(newSVpv(HvNAME(stash),0));
261 sv_catpvn(tmpstr, "::ISA", 5);
262 gv = gv_fetchpv(SvPV(tmpstr,na),TRUE,SVt_PVGV);
264 GvAV(gv) = (AV*)SvREFCNT_inc(av);
265 /* ... and re-try lookup */
266 gv = gv_fetchmeth(stash, name, nend - name, 0);
268 croak("Cannot create %s::ISA",HvNAME(stash));
278 if (strEQ(name,"import") || strEQ(name,"unimport"))
280 else if (strNE(name, "AUTOLOAD")) {
281 gv = gv_fetchmeth(stash, "AUTOLOAD", 8, 0);
282 if (gv && (cv = GvCV(gv))) { /* One more chance... */
283 SV *tmpstr = sv_2mortal(newSVpv(HvNAME(stash),0));
284 sv_catpvn(tmpstr,"::", 2);
285 sv_catpvn(tmpstr, name, nend - name);
286 sv_setsv(GvSV(CvGV(cv)), tmpstr);
288 sv_unmagic(GvSV(CvGV(cv)), 't');
296 gv_stashpv(name,create)
300 return gv_stashpvn(name, strlen(name), create);
304 gv_stashpvn(name,namelen,create)
313 if (namelen > 1200) {
316 warn("Weird package name \"%s\" truncated", name);
318 warn("Weird package name \"%.*s...\" truncated", namelen, name);
321 Copy(name,tmpbuf,namelen,char);
322 tmpbuf[namelen++] = ':';
323 tmpbuf[namelen++] = ':';
324 tmpbuf[namelen] = '\0';
325 tmpgv = gv_fetchpv(tmpbuf,create, SVt_PVHV);
329 GvHV(tmpgv) = newHV();
332 HvNAME(stash) = savepv(name);
337 gv_stashsv(sv,create)
344 return gv_stashpvn(ptr, len, create);
349 gv_fetchpv(nambeg,add,sv_type)
354 register char *name = nambeg;
358 register char *namend;
363 if (*name == '*' && isALPHA(name[1])) /* accidental stringify on a GV? */
366 for (namend = name; *namend; namend++) {
367 if ((*namend == '\'' && namend[1]) ||
368 (*namend == ':' && namend[1] == ':'))
372 if (!stash || !SvREFCNT(stash)) /* symbol table under destruction */
377 New(601, tmpbuf, len+3, char);
378 Copy(name, tmpbuf, len, char);
382 gvp = (GV**)hv_fetch(stash,tmpbuf,len,add);
384 if (!gvp || *gvp == (GV*)&sv_undef)
388 if (SvTYPE(gv) == SVt_PVGV)
393 gv_init(gv, stash, nambeg, namend - nambeg, (add & 2));
395 if (!(stash = GvHV(gv)))
396 stash = GvHV(gv) = newHV();
399 HvNAME(stash) = savepvn(nambeg, namend - nambeg);
407 return gv ? gv : (GV*)*hv_fetch(defstash, "main::", 6, TRUE);
414 /* No stash in name, so see how we can default */
417 if (isIDFIRST(*name)) {
418 if (isUPPER(*name)) {
420 if (*name == 'S' && (
421 strEQ(name, "SIG") ||
422 strEQ(name, "STDIN") ||
423 strEQ(name, "STDOUT") ||
424 strEQ(name, "STDERR") ))
427 else if (*name > 'E') {
428 if (*name == 'I' && strEQ(name, "INC"))
431 else if (*name > 'A') {
432 if (*name == 'E' && strEQ(name, "ENV"))
435 else if (*name == 'A' && (
436 strEQ(name, "ARGV") ||
437 strEQ(name, "ARGVOUT") ))
440 else if (*name == '_' && !name[1])
444 else if ((COP*)curcop == &compiling) {
446 if (add && (hints & HINT_STRICT_VARS) &&
447 sv_type != SVt_PVCV &&
448 sv_type != SVt_PVGV &&
449 sv_type != SVt_PVFM &&
450 sv_type != SVt_PVIO &&
451 !(len == 1 && sv_type == SVt_PV && strchr("ab",*name)) )
453 gvp = (GV**)hv_fetch(stash,name,len,0);
455 *gvp == (GV*)&sv_undef ||
456 SvTYPE(*gvp) != SVt_PVGV)
460 else if (sv_type == SVt_PV && !GvIMPORTED_SV(*gvp) ||
461 sv_type == SVt_PVAV && !GvIMPORTED_AV(*gvp) ||
462 sv_type == SVt_PVHV && !GvIMPORTED_HV(*gvp) )
464 warn("Variable \"%c%s\" is not imported",
465 sv_type == SVt_PVAV ? '@' :
466 sv_type == SVt_PVHV ? '%' : '$',
469 warn("(Did you mean &%s instead?)\n", name);
475 stash = curcop->cop_stash;
481 /* By this point we should have a stash and a name */
485 warn("Global symbol \"%s\" requires explicit package name", name);
487 stash = curstash ? curstash : defstash; /* avoid core dumps */
493 if (!SvREFCNT(stash)) /* symbol table under destruction */
496 gvp = (GV**)hv_fetch(stash,name,len,add);
497 if (!gvp || *gvp == (GV*)&sv_undef)
500 if (SvTYPE(gv) == SVt_PVGV) {
503 gv_init_sv(gv, sv_type);
508 /* Adding a new symbol */
511 warn("Had to create %s unexpectedly", nambeg);
512 gv_init(gv, stash, name, len, add & 2);
513 gv_init_sv(gv, sv_type);
515 /* set up magic where warranted */
518 if (strEQ(name, "ARGV")) {
519 IoFLAGS(GvIOn(gv)) |= IOf_ARGV|IOf_START;
529 if (strnEQ(name, "EXPORT", 6))
533 if (strEQ(name, "ISA")) {
536 sv_magic((SV*)av, (SV*)gv, 'I', Nullch, 0);
537 if (add & 2 && strEQ(nambeg,"AnyDBM_File::ISA") && AvFILL(av) == -1)
540 av_push(av, newSVpv(pname = "NDBM_File",0));
541 gv_stashpvn(pname, 9, TRUE);
542 av_push(av, newSVpv(pname = "DB_File",0));
543 gv_stashpvn(pname, 7, TRUE);
544 av_push(av, newSVpv(pname = "GDBM_File",0));
545 gv_stashpvn(pname, 9, TRUE);
546 av_push(av, newSVpv(pname = "SDBM_File",0));
547 gv_stashpvn(pname, 9, TRUE);
548 av_push(av, newSVpv(pname = "ODBM_File",0));
549 gv_stashpvn(pname, 9, TRUE);
555 if (strEQ(name, "OVERLOAD")) {
558 sv_magic((SV*)hv, (SV*)gv, 'A', 0, 0);
561 #endif /* OVERLOAD */
563 if (strEQ(name, "SIG")) {
569 hv_magic(hv, siggv, 'S');
570 for(i=1;sig_name[i];i++) {
572 init=hv_fetch(hv,sig_name[i],strlen(sig_name[i]),1);
574 sv_setsv(*init,&sv_undef);
578 /* initialize signal stack */
579 signalstack = newAV();
580 AvREAL_off(signalstack);
581 av_extend(signalstack, 30);
582 av_fill(signalstack, 0);
610 sv_setpv(GvSV(gv),chopset);
615 if (dowarn && len == 1 && sv_type == SVt_PV)
616 warn("Use of $%s is deprecated", name);
660 SvREADONLY_on(GvSV(gv));
662 sv_magic(GvSV(gv), (SV*)gv, 0, name, len);
668 sv_setpv(GvSV(gv),"\f");
674 sv_setpv(GvSV(gv),"\034");
680 sv_upgrade(sv, SVt_PVNV);
681 sv_setpv(sv, patchlevel);
693 HV *hv = GvSTASH(gv);
697 sv_setpv(sv, sv == (SV*)gv ? "*" : "");
698 sv_catpv(sv,HvNAME(hv));
699 sv_catpvn(sv,"::", 2);
700 sv_catpvn(sv,GvNAME(gv),GvNAMELEN(gv));
717 sv_setpv(sv, sv == (SV*)gv ? "*" : "");
718 sv_catpv(sv,HvNAME(hv));
719 sv_catpvn(sv,"::", 2);
720 sv_catpvn(sv,GvNAME(egv),GvNAMELEN(egv));
729 io = (IO*)NEWSV(0,0);
730 sv_upgrade((SV *)io,SVt_PVIO);
733 iogv = gv_fetchpv("IO::Handle::", TRUE, SVt_PVHV);
734 SvSTASH(io) = (HV*)SvREFCNT_inc(GvHV(iogv));
750 for (i = 0; i <= (I32) HvMAX(stash); i++) {
751 for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) {
752 if (HeKEY(entry)[HeKLEN(entry)-1] == ':' &&
753 (gv = (GV*)HeVAL(entry)) && (hv = GvHV(gv)) && HvNAME(hv))
756 gv_check(hv); /* nested package */
758 else if (isALPHA(*HeKEY(entry))) {
759 gv = (GV*)HeVAL(entry);
762 curcop->cop_line = GvLINE(gv);
763 filegv = GvFILEGV(gv);
764 curcop->cop_filegv = filegv;
765 if (filegv && GvMULTI(filegv)) /* Filename began with slash */
767 warn("Name \"%s::%s\" used only once: possible typo",
768 HvNAME(stash), GvNAME(gv));
778 (void)sprintf(tokenbuf,"%s::_GEN_%ld",pack,(long)gensym++);
779 return gv_fetchpv(tokenbuf,TRUE, SVt_PVGV);
782 /* hopefully this is only called on local symbol table entries */
800 if (!gv || !(gp = GvGP(gv)))
802 if (gp->gp_refcnt == 0) {
803 warn("Attempt to free unreferenced glob pointers");
806 if (--gp->gp_refcnt > 0) {
807 if (gp->gp_egv == gv)
812 SvREFCNT_dec(gp->gp_sv);
813 SvREFCNT_dec(gp->gp_av);
814 SvREFCNT_dec(gp->gp_hv);
815 SvREFCNT_dec(gp->gp_io);
816 if ((cv = gp->gp_cv) && !GvCVGEN(gv))
818 SvREFCNT_dec(gp->gp_form);
824 #if defined(CRIPPLED_CC) && (defined(iAPX286) || defined(M_I286) || defined(I80286))
828 #ifdef MICROPORT /* Microport 2.4 hack */
833 return GvGP(gv)->gp_av;
835 return GvGP(gv_AVadd(gv))->gp_av;
842 return GvGP(gv)->gp_hv;
844 return GvGP(gv_HVadd(gv))->gp_hv;
846 #endif /* Microport 2.4 hack */
849 /* Updates and caches the CV's */
859 MAGIC* mg=mg_find((SV*)stash,'c');
860 AMT *amtp=mg ? (AMT*)mg->mg_ptr: NULL;
862 if (mg && (amtp=((AMT*)(mg->mg_ptr)))->was_ok_am == amagic_generation &&
863 amtp->was_ok_sub == sub_generation)
864 return HV_AMAGIC(stash)? TRUE: FALSE;
865 gvp=(GV**)hv_fetch(stash,"OVERLOAD",8,FALSE);
866 if (amtp && amtp->table) {
868 for (i=1;i<NofAMmeth*2;i++) {
869 if (amtp->table[i]) {
870 SvREFCNT_dec(amtp->table[i]);
874 sv_unmagic((SV*)stash, 'c');
876 DEBUG_o( deb("Recalcing overload magic in package %s\n",HvNAME(stash)) );
878 if (gvp && ((gv = *gvp) != (GV*)&sv_undef && (hv = GvHV(gv)))) {
887 /* if (*(svp)==(SV*)amagic_generation && *(svp+1)==(SV*)sub_generation) {
888 DEBUG_o( deb("Overload magic in package %s up-to-date\n",HvNAME(stash))
890 return HV_AMAGIC(stash)? TRUE: FALSE;
893 amt.was_ok_am=amagic_generation;
894 amt.was_ok_sub=sub_generation;
895 amt.fallback=AMGfallNO;
897 /* Work with "fallback" key, which we assume to be first in AMG_names */
899 if ((cp=((char**)(*AMG_names))[0]) &&
900 (svp=(SV**)hv_fetch(hv,cp,strlen(cp),FALSE)) && (sv = *svp)) {
901 if (SvTRUE(sv)) amt.fallback=AMGfallYES;
902 else if (SvOK(sv)) amt.fallback=AMGfallNEVER;
905 for (i=1;i<NofAMmeth*2;i++) {
908 if ( (cp=((char**)(*AMG_names))[i]) ) {
909 svp=(SV**)hv_fetch(hv,cp,strlen(cp),FALSE);
910 if (svp && ((sv = *svp) != &sv_undef)) {
911 switch (SvTYPE(sv)) {
914 if (!SvOK(sv)) break;
915 gv = gv_fetchmethod(stash, SvPV(sv, na));
916 if (gv) cv = GvCV(gv);
920 if (SvTYPE(cv) == SVt_PVCV)
925 die("Not a subroutine reference in %%OVERLOAD");
931 if (!(cv = GvCV((GV*)sv)))
932 cv = sv_2cv(sv, &stash, &gv, TRUE);
937 die("Method for operation %s not found in package %.256s during blessing\n",
943 amt.table[i]=(CV*)SvREFCNT_inc(cv);
945 sv_magic((SV*)stash, 0, 'c', (char*)&amt, sizeof(amt));
947 /* HV_badAMAGIC_off(stash);*/
952 /*HV_badAMAGIC_off(stash);*/
953 HV_AMAGIC_off(stash);
957 /* During call to this subroutine stack can be reallocated. It is
958 * advised to call SPAGAIN macro in your code after call */
961 amagic_call(left,right,method,flags)
969 CV **cvp=NULL, **ocvp=NULL;
971 int fl=0, off, off1, lr=0, assign=AMGf_assign & flags, notfound=0;
972 int postpr=0, inc_dec_ass=0, assignshift=assign?1:0;
974 if (!(AMGf_noleft & flags) && SvAMAGIC(left)
975 && (mg = mg_find((SV*)(stash=SvSTASH(SvRV(left))),'c'))
976 && (ocvp = cvp = ((oamtp=amtp=(AMT*)mg->mg_ptr)->table))
977 && ((cv = cvp[off=method+assignshift])
978 || (assign && amtp->fallback > AMGfallNEVER && /* fallback to
980 (fl = 1, cv = cvp[off=method])))) {
981 lr = -1; /* Call method for left argument */
983 if (cvp && amtp->fallback > AMGfallNEVER && flags & AMGf_unary) {
986 /* look for substituted methods */
989 if (((cv = cvp[off=add_ass_amg]) && (inc_dec_ass=1))
990 || ((cv = cvp[off=add_amg]) && (postpr=1))) {
991 right = &sv_yes; lr = -1; assign = 1;
995 if (((cv = cvp[off=subtr_ass_amg]) && (inc_dec_ass=1))
996 || ((cv = cvp[off=subtr_amg]) && (postpr=1))) {
997 right = &sv_yes; lr = -1; assign = 1;
1001 (void)((cv = cvp[off=numer_amg]) || (cv = cvp[off=string_amg]));
1004 (void)((cv = cvp[off=string_amg]) || (cv = cvp[off=bool__amg]));
1007 (void)((cv = cvp[off=numer_amg]) || (cv = cvp[off=bool__amg]));
1010 (void)((cv = cvp[off=bool__amg])
1011 || (cv = cvp[off=numer_amg])
1012 || (cv = cvp[off=string_amg]));
1018 if (!SvROK(ref) && SvTYPE(ref) <= SVt_PVMG) { /* Just to be
1025 SV* newref = newSVsv(ref);
1026 SvOBJECT_on(newref);
1027 SvSTASH(newref) = (HV*)SvREFCNT_inc(SvSTASH(ref));
1033 if ((cvp[off1=lt_amg] || cvp[off1=ncmp_amg])
1034 && ((cv = cvp[off=neg_amg]) || (cv = cvp[off=subtr_amg]))) {
1035 SV* nullsv=sv_2mortal(newSViv(0));
1037 SV* lessp = amagic_call(left,nullsv,
1038 lt_amg,AMGf_noright);
1039 logic = SvTRUE(lessp);
1041 SV* lessp = amagic_call(left,nullsv,
1042 ncmp_amg,AMGf_noright);
1043 logic = (SvNV(lessp) < 0);
1046 if (off==subtr_amg) {
1057 if (cv = cvp[off=subtr_amg]) {
1059 left = sv_2mortal(newSViv(0));
1066 if (!cv) goto not_found;
1067 } else if (!(AMGf_noright & flags) && SvAMAGIC(right)
1068 && (mg = mg_find((SV*)(stash=SvSTASH(SvRV(right))),'c'))
1069 && (cvp = ((amtp=(AMT*)mg->mg_ptr)->table))
1070 && (cv = cvp[off=method])) { /* Method for right
1073 } else if (((ocvp && oamtp->fallback > AMGfallNEVER
1074 && (cvp=ocvp) && (lr = -1))
1075 || (cvp && amtp->fallback > AMGfallNEVER && (lr=1)))
1076 && !(flags & AMGf_unary)) {
1077 /* We look for substitution for
1078 * comparison operations and
1080 if (method==concat_amg || method==concat_ass_amg
1081 || method==repeat_amg || method==repeat_ass_amg) {
1082 return NULL; /* Delegate operation to string conversion */
1092 postpr = 1; off=ncmp_amg; break;
1099 postpr = 1; off=scmp_amg; break;
1101 if (off != -1) cv = cvp[off];
1106 not_found: /* No method found, either report or die */
1107 if (ocvp && (cv=ocvp[nomethod_amg])) { /* Call report method */
1108 notfound = 1; lr = -1;
1109 } else if (cvp && (cv=cvp[nomethod_amg])) {
1110 notfound = 1; lr = 1;
1112 if (off==-1) off=method;
1113 sprintf(buf, "Operation `%s': no method found,\n\tleft argument %s%.256s,\n\tright argument %s%.256s",
1114 ((char**)AMG_names)[method + assignshift],
1116 "in overloaded package ":
1117 "has no overloaded magic",
1119 HvNAME(SvSTASH(SvRV(left))):
1122 "in overloaded package ":
1123 "has no overloaded magic",
1125 HvNAME(SvSTASH(SvRV(right))):
1127 if (amtp && amtp->fallback >= AMGfallYES) {
1128 DEBUG_o( deb(buf) );
1137 DEBUG_o( deb("Overloaded operator `%s'%s%s%s:\n\tmethod%s found%s in package %.256s%s\n",
1138 ((char**)AMG_names)[off],
1139 method+assignshift==off? "" :
1141 method+assignshift==off? "" :
1142 ((char**)AMG_names)[method+assignshift],
1143 method+assignshift==off? "" : "')",
1144 flags & AMGf_unary? "" :
1145 lr==1 ? " for right argument": " for left argument",
1146 flags & AMGf_unary? " for argument" : "",
1148 fl? ",\n\tassignment variant used": "") );
1149 /* Since we use shallow copy during assignment, we need
1150 * to dublicate the contents, probably calling user-supplied
1151 * version of copy operator
1153 if ((method + assignshift==off
1154 && (assign || method==inc_amg || method==dec_amg))
1155 || inc_dec_ass) RvDEEPCP(left);
1162 Zero(&myop, 1, BINOP);
1163 myop.op_last = (OP *) &myop;
1164 myop.op_next = Nullop;
1165 myop.op_flags = OPf_KNOW|OPf_STACKED;
1170 if (perldb && curstash != debstash)
1171 op->op_private |= OPpENTERSUB_DB;
1175 EXTEND(sp, notfound + 5);
1176 PUSHs(lr>0? right: left);
1177 PUSHs(lr>0? left: right);
1178 PUSHs( assign ? &sv_undef : (lr>0? &sv_yes: &sv_no));
1180 PUSHs( sv_2mortal(newSVpv(((char**)AMG_names)[method + assignshift],0)) );
1185 if (op = pp_entersub())
1194 /* sv_2mortal(res); */
1203 ans=SvIV(res)<=0; break;
1206 ans=SvIV(res)<0; break;
1209 ans=SvIV(res)>=0; break;
1212 ans=SvIV(res)>0; break;
1215 ans=SvIV(res)==0; break;
1218 ans=SvIV(res)!=0; break;
1221 SvSetSV(left,res); return res; break;
1223 ans=!SvOK(res); break;
1225 return ans? &sv_yes: &sv_no;
1226 } else if (method==copy_amg) {
1228 die("Copy method did not return a reference");
1230 return SvREFCNT_inc(SvRV(res));
1236 #endif /* OVERLOAD */