You are seeing the bug in a form where it almost makes
sense. However it really is a bug. When I first saw this,
it was a bug in Number::Format
which turned out
to be due to a construct of this form:
my $foo = $some_init unless test();
The resulting bug is that if the test failed on 2 calls in
a row, you had data from the first call of the function
that polluted your output results. This bug was quite
subtle and mysterious, and it turned out had been reported
to the module author several times over the course of a
year, but he was unable to figure out where the bug was.
Since then whenever I have looked at a large body of code
for either of the patterns:
/my .* if/
/my .* unless/
and found a match, it has usually resulted in also finding a
bug. In short, this is a "feature" that is due to a
broken optimization of Perl which, when it is hit in code,
is almost always the cause of a bug in that code.
Now if you want static lexical variables without the usual
"create a private scope" trick, that is doable in a fairly
straightforward manner. In fact I just wrote and tested an
implementation, which I just uploaded to CPAN. Hopefully
Tie::Static will be accepted and become available
shortly. (I intend to post the module to PerlMonks in a
short while as well.)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||