My main reaction to this is "I bet you are using Win32" and "This won't happen on Unix". Locking in Win32 can prevent reading and writing of data via other file handles (even within the same process). Locking in Unix only affects other locking (by default) and only those held by a different process [ well, at least for the types of locking that I'm most familiar with, fcntl locks; I won't swear that some flocks won't block a process from itself ].
So you could probably get away with flocking the DATA file handle in a BEGIN block, even on Win32, if Perl defined the DATA file handle inside BEGIN blocks (since it hasn't parsed the __END__ yet, it doesn't yet know whether it is supposed to give you a DATA file handle or not).
Also, I really think Perl could use a patch such that it reports when it gets an error reading the source code. I think you would have been much happier if you'd seen this:
Error reading script source, highlander: Permission denied
(if it also reported $^E and not just $! then you'd even be told "The process cannot access the file because another process has locked a portion of the file" of which the "another process" part might well be a lie, but that is Win32's fault, not Perl's).
- tye
-
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.
|