Hi there

I'm dealing with some very odd behaviour as I migrate a process of mine from perl 5.8.8 to perl 5.12.1

I have created a small script (pasted below) that reproduces the problem; what seems to be happening is that the require statement of the module Vip.pm, which contains:

use Net::DNS; my $resolver = new Net::DNS::Resolver();

causes the SIG{CHLD} handler to be reset in some way when running on perl 5.12.1, which results in an error.

But on 5.8.8 the SIG{CHLD} handler is unchanged after the require statement.

If I add "use Net::DNS::Resolver;" at the top of the mytest.pl script (but leave the require as-is), then the output of the script on perl v 5.12.1 becomes the same as 5.8.8 (the signal handler remains unchanged)

Also, if I change Vip.pm to require another module (e.g. Digest::MD5), I don't get this behaviour, the output of the script on perl v5.12.1 and 5.8.8 is again the same (signal handler remains unchanged)

Finally, the error (when running on perl 5.12.1) appears as below in my reproducer script, but when running in my actual process appears as:

"Signal SIGCHLD received, but no signal handler set."

I'm running on Red Hat Enterprise Linux Server release 5.11

Here's the output of my program on perl v5.8.8
-----------------------------------------------

Before setting SIG{CHLD} its value is...<br/> $VAR1 = undef;<br/> After setting SIG{CHLD} its value is...<br/> $VAR1 = sub { "DUMMY" };<br/> After require statement SIG{CHLD} value is...<br/> $VAR1 = sub { "DUMMY" };<br/> Calling ping now...<br/> I AM A SIG{CHLD} handler<br/> Reading ping stream...<br/> Reading ping stream...<br/> Reading ping stream...<br/> Reading ping stream...<br/> Reading ping stream...<br/> Reading ping stream...<br/> DONE

Here's the output of my program on perl v5.12.1
---------------------------------------------

Before setting SIG{CHLD} its value is...<br/> $VAR1 = undef;<br/> After setting SIG{CHLD} its value is...<br/> $VAR1 = sub { "DUMMY" };<br/> After require statement SIG{CHLD} value is...<br/> $VAR1 = undef;<br/> Calling ping now...<br/> Reading ping stream...<br/> Use of uninitialized value in iteration finalizer at mytest.pl line 21 +, <PING> line 1.<br/> Unable to create sub named "" at mytest.pl line 21, <PING> line 1.</p>

Here is the code in my test script:
------------------------------------

use strict; use warnings; use Data::Dumper; use POSIX; print "Before setting SIG{CHLD} its value is...\n"; print Dumper($SIG{CHLD}); $SIG{CHLD}= \&REAPER; print "After setting SIG{CHLD} its value is...\n"; print Dumper($SIG{CHLD}); require Error::Vip; print "After require statement SIG{CHLD} value is...\n"; print Dumper($SIG{CHLD}); print "Calling ping now...\n"; my @cmd = ('ping', '-c', 1, '-n', '-A', '-W', 1, "164.55.89.62"); open (PING, '-|', @cmd) or confess("Can't ping -- $!"); while (my $ping = <PING>) { print "Reading ping stream...\n"; } close PING; print "DONE\n"; sub REAPER { print "I AM A SIG{CHLD} handler\n" }

Here's the code in Error/Vip.pm
-------------------------------

package Error::Test; use strict; use warnings; use Net::DNS; my $resolver = new Net::DNS::Resolver(); 1;

In reply to SIG{CHLD} altered by require statement on Perl 5.12.1 by sdingare

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.