Hello,

This simple program exhibits the difference in behaviour between 0.32
and 0.31 :

    use POE;

    my $rc = system("/bin/true");

    if ($rc == -1) {
        print "failed to execute: $!\n";
    } else {
        print "executed just fine\n";
    }

Reading perldoc perlvar on $?:

   If you have installed a signal handler for "SIGCHLD", the value of $?
   will usually be wrong outside that handler.

This happens because the import of POE.pm does an eval of use POE::Kernel.
Its import in turn executes a POE::Kernel::->new, which then does
amongst much other stuff a $self->_data_sig_initialize(); Which calls
loop_ignore_signal. This has changed between 0.31 and 0.32 :

@@ -53,6 +53,7 @@

   # Child process has stopped.
   if ($signal eq 'CHLD' or $signal eq 'CLD') {
+    $SIG{$signal} = "DEFAULT";
     $self->_data_sig_begin_polling();
     return;
   }
@@ -72,6 +73,13 @@

   if ($signal eq 'CHLD' or $signal eq 'CLD') {
     $self->_data_sig_cease_polling();
+    $SIG{$signal} = "IGNORE";
+    return;
+  }
+
+  if ($signal eq 'PIPE') {
+    $SIG{$signal} = "IGNORE";
+    return;
   }

   $SIG{$signal} = "DEFAULT";

So effectivelly all system calls in POE programs that want to check the
result status of their calls cannot do so anymore directly. Or you have
to install a SIGCHLD handler yourself. Much of our code has the above 
idiom, where we check immediately. Much unhappiness with 0.32 as it
returns -1 now. 

Is this a desired change in behaviour? 

Cheers,
-- 
Merijn Broeren | Sometime in the middle ages, God got fed up with us 
Software Geek  | and put earth at sol.milky-way.univ in his kill-file.
               | Pray all you want, it just gets junked.

Reply via email to