Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Tuesday September 23, 2003
11:36 PM

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

[ #14872 ]

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.
More | Login | Reply
Loading... please wait.