Has anyone been able to successfully use fork() in the Windows and OLE environment? I have tried a simple test case and I get bizarre error messages after blowing the Perl interpreter out of the water.

Here is a snippet of the test case code:

$| = 1; if ($pid = fork) { print "this is the parent $pid\n"; while ($prange ne '$A$3') { eval {$prange = $excel->ActiveCell->{Address};}; print "$@\n" if ($@); print "Active cell address $prange\n"; sleep 3; } } elsif (defined $pid) { print "this is the child $pid\n"; $msg = "When finished editing, close the file\."; Win32::MsgBox("$msg",vbOKOnly,$mbt); #$ans = <STDIN>; exit; } else { print "fell through\n"; }
The message box appears correctly. The output in the "Run" (aka Command Prompt) window from which the program is started is as follows:
this is the parent -2072 this is the child 0 Active cell address $C$23 Active cell address $C$23
and that continues until I click on "OK" in the message box. At that point I get the following messages:
Attempt to free non-existent shared string 'Range' at <eval 1> line 1. Free to wrong pool 1e5da80 not 223f90 at <eval 1> line 1.
If I uncomment the "$ans = <STDIN>;" statement I get the same error messages but they now say:
Attempt to free non-existent shared string 'Range' at <eval 1> line 1, + <STDIN> line 1. Free to wrong pool 1e5dce0 not 223f90 at <eval 1> line 1, <STDIN> line + 1.
If I comment out the "exit" statement in the child block I immediately get the window that says the "Perl Command Line Interpreter has encountered a problem and needs to close" and asks if I want to send a report to Microsoft. In this case the command prompt window has this very interesting error message:
Undefined subroutine &Carp::shortness_heavy called at c:/Perl/lib/Carp +.pm line 182. Free to wrong pool 1e5da30 not 223f90.
I then get "Active cell address" output every 3 seconds until I click on "Don't send" to Microsoft box. Then the Perl program terminates.

Is there something basic that I am missing?


In reply to Fork in Win32 environment by esr

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.