Change 27712 by [EMAIL PROTECTED] on 2006/04/04 11:42:05

        Subject: [PATCH] threads.pm should overload != operator
        From: "Jan Dubois" <[EMAIL PROTECTED]>
        Date: Mon, 3 Apr 2006 18:06:24 -0700
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/ext/threads/t/basic.t#18 edit
... //depot/perl/ext/threads/threads.pm#48 edit

Differences ...

==== //depot/perl/ext/threads/t/basic.t#18 (xtext) ====
Index: perl/ext/threads/t/basic.t
--- perl/ext/threads/t/basic.t#17~27705~        2006-04-03 09:21:57.000000000 
-0700
+++ perl/ext/threads/t/basic.t  2006-04-04 04:42:05.000000000 -0700
@@ -15,7 +15,7 @@
 
 use ExtUtils::testlib;
 
-BEGIN { $| = 1; print "1..30\n" };
+BEGIN { $| = 1; print "1..32\n" };
 use threads;
 
 
@@ -131,28 +131,31 @@
 my $thr2 = threads->create(sub {});
 my $thr3 = threads->object($thr1->tid());
 
-ok(20, $thr1 != $thr2,   'Treads not equal');
-ok(21, $thr1 == $thr3,   'Threads equal');
+# Make sure both overloaded '==' and '!=' are working correctly
+ok(20,   $thr1 != $thr2,  'Treads not equal');
+ok(21, !($thr1 == $thr2), 'Treads not equal');
+ok(22,   $thr1 == $thr3,  'Threads equal');
+ok(23, !($thr1 != $thr3), 'Threads equal');
 
-ok(22, $thr1->_handle(), 'Handle method');
-ok(23, $thr2->_handle(), 'Handle method');
+ok(24, $thr1->_handle(), 'Handle method');
+ok(25, $thr2->_handle(), 'Handle method');
 
-ok(24, threads->object($thr1->tid())->tid() == 11, 'Object method');
-ok(25, threads->object($thr2->tid())->tid() == 12, 'Object method');
+ok(26, threads->object($thr1->tid())->tid() == 11, 'Object method');
+ok(27, threads->object($thr2->tid())->tid() == 12, 'Object method');
 
 $thr1->join();
 $thr2->join();
 
-my $sub = sub { ok(26, shift() == 1, "Test code ref"); };
+my $sub = sub { ok(28, shift() == 1, "Test code ref"); };
 threads->create($sub, 1)->join();
 
 my $thrx = threads->object(99);
-ok(27, ! defined($thrx), 'No object');
+ok(29, ! defined($thrx), 'No object');
 $thrx = threads->object();
-ok(28, ! defined($thrx), 'No object');
+ok(30, ! defined($thrx), 'No object');
 $thrx = threads->object(undef);
-ok(29, ! defined($thrx), 'No object');
+ok(31, ! defined($thrx), 'No object');
 $thrx = threads->object(0);
-ok(30, ! defined($thrx), 'No object');
+ok(32, ! defined($thrx), 'No object');
 
 # EOF

==== //depot/perl/ext/threads/threads.pm#48 (xtext) ====
Index: perl/ext/threads/threads.pm
--- perl/ext/threads/threads.pm#47~27705~       2006-04-03 09:21:57.000000000 
-0700
+++ perl/ext/threads/threads.pm 2006-04-04 04:42:05.000000000 -0700
@@ -29,6 +29,7 @@
 
 use overload
     '==' => \&equal,
+    '!=' => sub { !equal(@_) },
     'fallback' => 1;
 
 BEGIN {
@@ -38,7 +39,7 @@
                if($threads::shared::threads_shared);
 }
 
-our $VERSION = '1.18';
+our $VERSION = '1.18_01';
 
 
 # Load the XS code
End of Patch.

Reply via email to