patch full of dark magic

Alexandr Ciornii <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
(It is beginning to feel colder in your room. It's a strange feeling,
like someone is present here,  although you are alone... You now begin
to hear some voices. It is some other person, from far, far away
trying to tell something important to you.)

A shaman of other realm asked me to call to my gods of MSWindows realm
for help. It required some time executing dark shaman rituals (at
least 4 candies were sacrificed), and gods by method of tests and
errors sent this solution to me. My mind is weak compared to gods one,
so I can't understand this code, but godly presence makes this
wonderful code work! I can only hope that this code will work in other
realms too - my mind and body are too tired now to penetrate to other
realm and test. I'll leave this task to you, shamans of other realms.

P.S. This patch has an important advantage - it works.
P.P.S. Now I should sacrifice some more candies to regain my strength.

-- 
Alexandr Ciornii, http://chorny.net
16destroy.t.diff (application/octet-stream, 1.2 KB)
--- 16destroy.t.bak	2010-08-07 00:40:59.578125000 +0300
+++ 16destroy.t	2010-08-07 00:39:40.640625000 +0300
@@ -76,12 +76,21 @@
     }
 
     sub DESTROY {
-        if ($expect_active < 0) {
-            exit shift->FETCH('Active') || 0;
+        if ($expect_active < 0) { #inside child
+            if ($^O =~ /win/i) { #Win32 dark magic. It works, so don't change anything
+                my $self=shift;
+                if ($self->FETCH('Active')>0) {
+                    fail "Child should be inactive on DESTROY";
+                    exit $self->FETCH('Active') || 0; #exit in DESTROY on Windows works unpredictably
+                }
+            } else {
+                exit shift->FETCH('Active') || 0;
+            }
+        } else {
+            return $expect_active
+                ? ok( shift->FETCH('Active'), 'Should be active in DESTROY')
+                : ok( !shift->FETCH('Active'), 'Should not be active in DESTROY');
         }
-        return $expect_active
-            ? ok( shift->FETCH('Active'), 'Should be active in DESTROY')
-            : ok( !shift->FETCH('Active'), 'Should not be active in DESTROY');
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.