Sometimes, Perl code I work with exhibits signs of "quantum" behavior. By this I mean, in quantum physics, an electron behaves as both a wave and a particle, unless you actually look closely at it to see which one it chooses to behave as. In which case it behaves as a particle, which makes sense to everybody because an electron is a particle. See "Double Slit Experiment" for more on that.
At various different times in my software development career, a bug would pop up in the Perl code. Something is broken, the program gives wrong results or it crashes due to an error. Let's say the error is something that looks like,
Can't coerce array into hash at script.pl line 1337.
The obvious culprit here is that at line 1337, the variable it's trying to treat as an associative array (a hash) is instead a regular array. So first thing I would do here is find this line, and then add some "print" lines of code to see what type of data is in that variable. Aha, it's an array, now I have to trace it back in the code to find out at what point this data became an array.
Usually a problem like this occurs due to an oversight by one of the other developers. A developer trying to fix one bug might have assigned an array to this variable because it was convenient to solve their problem, and they didn't know at the time that the change has broken this code I'm working with now. So I go on debugging, adding print statements here and there to check what's inside every variable.
Once the problem is thoroughly diagnosed and I can see what's in every variable along the way, the bug just mysteriously vanishes. Every variable contains the data I would expect them to, the bug stops happening, and the only thing I changed in the code was just the simple adding of debug code. My code didn't modify the program in any tangible way, and yet the bug is gone.
So I have a WTF reaction, and remove all my debugging code. The bug is still "fixed." I check the svn diff
to see the differences between my copy of the code and the last copy I checked out from Subversion. Nothing that would make a difference. I svn revert
, turning my copy back to the original one, before I touched it at all. The bug is still gone!
So I blame the quantum perl fairy and call the bug resolved and it doesn't come back up again. Weird.
TL;DR - the QA people see a bug on their computers, file a bug report, the developer (me) sees the report, tests the bug to make sure it's there, begins debugging it only enough to diagnose the problem well enough that the next step would be to fix it, and the bug just fixes itself. The process of looking at the bug made the bug fix itself like some sort of black magic.
There are 2 comments on this page. Add yours.
There is clearly a whole lot to understand about this. I think you produced some excellent points in Functions also.Keep working.http://www.pokerpatron.com/film-streaming-gratuit
Perl is fun. Thanks a lot for the youtube link. It's really a great video!!!!!!
0.0103s
.