patch for LWP 5.05 to make it play with both 5.003 and 5.003_20 + overload patch

Randal Schwartz (merlyn@stonehenge.com)
14 Jan 1997 16:08:13 -0700


Here it is (wiping sweat off brow), tested with both _11 and
_20+patches.  You *must* get the overload patch from P5P or nothing
from _17 on will work.  I presume _21 (and 5.004) will have the overload
patch built in.

Eventually, the _init_implementor method can be completely eliminated
when the world has moved on to 5.004.

gadget>> diff -u lib/URI/URL.pm-DIST lib/URI/URL.pm
--- lib/URI/URL.pm-DIST	Wed Dec  4 08:12:55 1996
+++ lib/URI/URL.pm	Tue Jan 14 15:57:30 1997
@@ -1,6 +1,6 @@
 package URI::URL;
 
-$VERSION = "4.08";   # $Date: 1996/12/04 15:12:53 $
+$VERSION = "4.08_01";   # $Date: 1996/12/04 15:12:53 $
 sub Version { $VERSION; }
 
 require 5.002;
@@ -28,7 +28,6 @@
 use vars qw($reserved $reserved_no_slash $reserved_no_form $unsafe
 	    $COMPAT_VER_3
 	    $Debug $Strict_URL
-	    %OVERLOAD
 	   );
 
 $reserved          = ";\\/?:\\@&=#%"; # RFC 1738 reserved pluss '#' and '%'
@@ -43,10 +42,7 @@
 $COMPAT_VER_3  = 0;     # should we try to behave in the old way
 $Strict_URL    = 0;     # see new()
 
-# Should really use the new 'use overload' interface, but since
-# we fake inheritance of %OVERLOAD in _init_implementor() we keep
-# it for now.
-%OVERLOAD = ( '""' => 'as_string', 'fallback' => 1 );
+use overload ( '""' => 'as_string', 'fallback' => 1 );
 
 my %Implementor = (); # mapping from scheme to implementation class
 
@@ -179,7 +175,7 @@
     no strict qw(refs);
     # Setup overloading - experimental
     %{"${class}::OVERLOAD"} = %URI::URL::OVERLOAD
-	unless defined %{"${class}::OVERLOAD"};
+	unless defined %{"${class}::OVERLOAD"} or $] >= 5.003_17;
 }
 
 


-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me