Re: patch for LWP 5.05 to make it play with both 5.003 and 5.003_20 + overload patch
Ilya Zakharevich (ilya@math.ohio-state.edu)
Sun, 19 Jan 1997 23:41:52 -0500 (EST)
Gisle Aas writes:
>
> I'll managed to reduce it to the following test case. I still don't
> understand what is happening. It is something strange with the third
> URL and it only happens if we create some other type of URL as number 2.
>
> ---------
> $ cat uri.t
> $url = new URI::URL 'http://www/'; die if $url eq "x";
> $url = new URI::URL 'file://ftp/'; die if $url eq "x";
> $url = new URI::URL "http://www/"; die if $url eq "x";
>
> $ perl -MURI::URL uri.t
> Operation `eq': no method found,
> left argument in overloaded package URI::URL::http,
> right argument has no overloaded magic at uri.t line 3.
>
I was too thick in my previous message: it was a complete
crap. URI::URL defines fallback => 1, thus the above message should
never appear.
It is indeed a bug related to inheritance: fallback was taken to be
undef after some importation stub was erroneously left by resolution
of "fallback". The solution is to change this resolution to
"traceless" mode which leaves no stubs:
THIS IS an UNOFFICAL PATCH! official one follows soon (with updates to
pods, diagnostics.pm etc). The only relevant piece is one which
changes 0 to -1 in the second chunk.
Enjoy,
Ilya
--- gv.c~ Mon Jan 13 10:24:56 1997
+++ gv.c Sun Jan 19 20:15:54 1997
@@ -912,8 +912,8 @@
AMT *amtp=mg ? (AMT*)mg->mg_ptr: NULL;
AMT amt;
- if (mg && (amtp=((AMT*)(mg->mg_ptr)))->was_ok_am == amagic_generation &&
- amtp->was_ok_sub == sub_generation)
+ if (mg && amtp->was_ok_am == amagic_generation
+ && amtp->was_ok_sub == sub_generation)
return AMT_AMAGIC(amtp);
if (amtp && AMT_AMAGIC(amtp)) { /* Have table. */
int i;
@@ -997,10 +997,10 @@
if ( cp = (char *)AMG_names[0] ) {
/* Try to find via inheritance. */
- gv = gv_fetchmeth(stash, "()", 2, 0); /* A cooky: "()". */
+ gv = gv_fetchmeth(stash, "()", 2, -1); /* A cooky: "()". */
if (gv) sv = GvSV(gv);
- if (!sv) /* Empty */;
+ if (!gv) goto notable;
else if (SvTRUE(sv)) amt.fallback=AMGfallYES;
else if (SvOK(sv)) amt.fallback=AMGfallNEVER;
}
@@ -1057,6 +1057,7 @@
}
}
/* Here we have no table: */
+ notable:
AMT_AMAGIC_off(&amt);
sv_magic((SV*)stash, 0, 'c', (char*)&amt, sizeof(AMTS));
return FALSE;
@@ -1222,8 +1223,9 @@
notfound = 1; lr = 1;
} else {
if (off==-1) off=method;
- sprintf(buf, "Operation `%s': no method found,\n\tleft argument %s%.256s,\n\tright argument %s%.256s",
+ sprintf(buf, "Operation `%s': no method found,%sargument %s%.256s%s%.256s",
AMG_names[method + assignshift],
+ (flags & AMGf_unary ? " " : "\n\tleft "),
SvAMAGIC(left)?
"in overloaded package ":
"has no overloaded magic",
@@ -1231,8 +1233,10 @@
HvNAME(SvSTASH(SvRV(left))):
"",
SvAMAGIC(right)?
- "in overloaded package ":
- "has no overloaded magic",
+ ",\n\tright argument in overloaded package ":
+ (flags & AMGf_unary
+ ? ""
+ : ",\n\tright argument has no overloaded magic"),
SvAMAGIC(right)?
HvNAME(SvSTASH(SvRV(right))):
"");