This is interesting ... I should probably have done strace on this small example before. When I had a much larger example it gave way too much output. Anyway...

Starting the server and attaching an strace to both the parent and the child shows the behaviour of the child:

accept(3, 0x7fffc9d87e50, [4096]) = ? ERESTARTSYS (To be restart +ed) --- SIGINT (Interrupt) @ 0 (0) --- rt_sigreturn(0) = -1 EINTR (Interrupted system + call) rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0 rt_sigaction(SIGINT, NULL, {0x7f2796926bf0, [], SA_RESTORER, 0x7f27965 +044a0}, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [INT], NULL, 8) = 0 write(1, "======= BEGIN DESTROY:11977====="..., 36) = 36 write(2, "SV = ", 5) = 5 write(2, "IV(0x24c39a8) at 0x24c39b8\n REF"..., 65) = 65 write(2, " RV = 0x1ffab78\n", 17) = 17 write(2, " ", 2) = ? ERESTARTSYS (To be restart +ed) --- SIGTERM (Terminated) @ 0 (0) --- rt_sigreturn(0) = -1 EINTR (Interrupted system + call) ...
And later ...
write(2, " ", 2) = 2 write(1, "======= BEGIN DESTROY:11977====="..., 36) = 36 write(2, "SV = ", 5) = 5 write(2, "IV(0x24c38a0) at 0x24c38b0\n REF"..., 65) = 65 write(2, " RV = 0x1ffab78\n", 17) = 17 write(2, " ", 2) = 2 write(2, "SV = ", 5) = 5 write(2, "PVHV(0x2001880) at 0x1ffab78\n "..., 75) = 75 write(2, " ", 2) = 2 write(2, " STASH = 0x2019d40", 19) = 19 write(2, "\t\"MyModule\"\n", 12) = 12 write(2, " ", 2) = 2 write(2, " ARRAY = 0x0", 13) = 13 write(2, "\n", 1) = 1 write(2, " ", 2) = 2 write(2, " KEYS = 0\n", 11) = 11 write(2, " ", 2) = 2 write(2, " FILL = 0\n", 11) = 11 write(2, " ", 2) = 2 write(2, " MAX = 7\n", 10) = 10 write(2, " ", 2) = 2 write(2, " RITER = -1\n", 13) = 13 write(2, " ", 2) = 2 write(2, " EITER = 0x0\n", 14) = 14 write(1, "============ END DESTROY:11977=="..., 39) = 39 close(3) = 0 close(6) = 0 close(4) = 0 close(5) = 0 exit_group(0) = ? Process 11977 detached

So it really does start DESTROY twice.


In reply to Re^6: Is this absurd, or have I not RTFM? by petermogensen
in thread Is this absurd, or have I not RTFM? by petermogensen

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.