Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-19 10:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found