Note to self: read, don't scan, the docs

I was writing some Inline::C code when I became stuck trying to figure out why the following kept segfaulting:

string = SvPV(elem, PL_na); if (looks_like_number(string)) {

That was buried in a much larger snippet and it took a long time to narrow down. Specifically, I put print statements after every line to determine what was failing. Naturally, as soon as I saw that I was getting a segfault at "looks_like_number", I decided to read the docs (perldoc perlapi) where I saw that function, and not just scan them. That function takes a scalar, not a string.

if (looks_like_number(elem)) { string = SvPV(elem, PL_na);

Of course I discovered this only after I had posted a message to the Inline list. Had I taken the time to properly debug everything and narrow it down to the correct line, I would have seen the problem immediately. I find that when I program in C, I am much more likely to throw my hands up in despair than figure out what the problem actually is. I need to stop that.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Without JavaScript enabled, you might want to
use the classic discussion system instead. If you login, you can remember this preference.