On Thursday 27 February 2003 22:03, Fergal Daly wrote:
> Would it be acceptable to add a third argument to _deep_check to switch
> on/off bless checking, rather than having to reimplement the whole thing?

Below is a very simple patch to do that. That makes cmp_object very easy

F

-- 
Do you need someone with lots of Unix sysadmin and/or lots of OO software 
development experience? Go on, giz a job.
My CV - http://www.fergaldaly.com/cv.html

--- More.pm.scalar      2003-02-27 22:08:37.000000000 +0000
+++ More.pm     2003-02-27 22:22:46.000000000 +0000
@@ -1027,7 +1027,7 @@
 }
 
 sub _deep_check {
-    my($e1, $e2) = @_;
+    my($e1, $e2, $check_bless) = @_;
     my $ok = 0;
 
     my $eq;
@@ -1035,7 +1035,11 @@
         # Quiet uninitialized value warnings when comparing undefs.
         local $^W = 0; 
 
-        if( ! ref $e1 and ! ref $e2 and $e1 eq $e2 ) {
+        if ($check_bless and ref($e1) ne ref($e2)) {
+            push @Data_Stack, { vals => [$e1, $e2] };
+            $ok = 0;
+        }
+        elsif( ! ref $e1 and ! ref $e2 and $e1 eq $e2 ) {
             $ok = 1;
         }
         else {

Reply via email to