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).
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||