develooper Front page | perl.perl5.porters | Postings from April 2001

[PATCH] that's enough UNIVERSAL stuff for one day ...

Thread Next
From:
Mike Guy
Date:
April 26, 2001 11:08
Subject:
[PATCH] that's enough UNIVERSAL stuff for one day ...
Message ID:
E14sqBh-0002mI-00@libra.cus.cam.ac.uk
A final two more UNIVERSAL items.    One a trivial typo; the other errr...


Mike Guy

--- ./ext/List/Util/lib/Scalar/Util.pm.orig	Sun Apr 15 04:11:11 2001
+++ ./ext/List/Util/lib/Scalar/Util.pm	Thu Apr 26 17:49:21 2001
@@ -32,9 +32,6 @@
 
 # The code beyond here is only used if the XS is not installed
 
-# Hope nobody defines a sub by this name
-sub UNIVERSAL::a_sub_not_likely_to_be_here { ref($_[0]) }
-
 sub blessed ($) {
   local($@, $SIG{__DIE__}, $SIG{__WARN__});
   length(ref($_[0]))
@@ -49,8 +46,8 @@
 
   length($t = ref($r)) or return undef;
 
-  # This eval will fail if the reference is not blessed
-  eval { $r->a_sub_not_likely_to_be_here; 1 }
+  # This test will fail if the reference is not blessed
+  UNIVERSAL::isa($r||0, 'UNIVERSAL')
     ? do {
       $t = eval {
 	  # we have a GLOB or an IO. Stringify a GLOB gives it's name
--- ./gv.c.orig	Tue Apr 17 13:38:25 2001
+++ ./gv.c	Thu Apr 26 17:50:50 2001
@@ -163,7 +163,7 @@
 
 Returns the glob with the given C<name> and a defined subroutine or
 C<NULL>.  The glob lives in the given C<stash>, or in the stashes
-accessible via @ISA and @UNIVERSAL.
+accessible via @ISA and UNIVERSAL::.
 
 The argument C<level> should be either 0 or -1.  If C<level==0>, as a
 side-effect creates a glob with the given C<name> in the given C<stash>

End of patch

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About