Of course, this would make answering the question a lot easier and would also help me to identify further problems. However, having spent the last hour trying, I can't reproduce the problem with a simplified version.
Futhermore, I've actually now fixed the problem in the real application. Unfortunately, I'm not sure exactly what it was. I had a nested subroutine which was calling substr on a string variable from its outer scope; this variable contained the character data being chunked. I tried moving the procedure encoded in that subroutine into inline statements of the enclosing subroutine, thus dispensing with the nested subroutine, and now the problem does not occur. Possibly it was some sort of scoping problem, such as an unintended closing over that string variable?
| [reply] [d/l] |
ironchicken:
If you don't know what caused the problem, I wouldn't claim that you've fixed it. It's certainly possible that the bug is gone, but it's also possible that the bug still exists, and simply isn't manifesting itself right now. It may just need a different pattern of data to cause some other odd symptom. If you have a suspicion about what the problem *might* have been, I'd encourage you to experiment a little bit more and try to reproduce the bug.
If you can identify the problem then you can remove the bug with confidence. Additionally, you may learn something new about perl. I frequently find that tracking down bugs helps me either (a) learn more about the workings of perl, (b) figure out coding methods that are less error-prone, and/or (c) improve my ability to question my assumptions and locate bugs more easily.
I'm sure you've got tasks to complete, and since your immediate problem gone, there's a strong temptation to proceed with the next item in your list. I'm not going to tell you to pull a Captain Ahab and treat this bug as your Moby Dick, but I'd definitely put a little more time into it trying to find the definite cause.
</ramble_mode>
...roboticus
When your only tool is a hammer, all problems look like your thumb.
| [reply] |