With open(FH,"....|") perl in fact does not open a file, but a pipe to a newly created process.
When this process exits, it stays as a zombie as long as parent process does not collects its exit staus.
In C this is done by calling wait() or waitpid() function. Perl gives you
an abstraction for accessing processed as files, but the final collection of child's exit status
must be done anyway and it is done in the close function.
There is no direct or easy way of mod_perl doing this for you
(except for some playing with SIGCHLD handler, but there you will be a subject to filehandle leakage as well).
So just call close when it is appropriate.
To allway call close on everything that was open is
a good practice in any environment not only in mod_perl. But as mod_perl processes are long-running, this
bad practice pops up as a problem.
-
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.
|