Greetings Monks. Yet again I've been bitten by reference numification. Witness:

# commit in 1000-row chunks if ($row and ($row % $COMMIT_CHUNK_SIZE == 0)) { $dbh->commit; }

That code is supposed to commit a transaction every $COMMIT_CHUNK_SIZE rows. It would work great if $row was the row count. Unfortunately for me, $row was actually an ARRAY ref, which meant that the commits never happened (or happened on every row, if the pointer in $row happened to be an even multiple of $COMMIT_CHUNK_SIZE). Even more unfortunately, this usually didn't matter because MySQL was able to handle quite a lot of inserts in a single transaction. That is, until it couldn't, and blew up with a buffer size error in the middle of an 8-hour job.

Here's what I would have liked to see when that code ran:

   Warning: numifcation of a reference at line 100.

Intentional numification of a reference is so rare, and unintential numification is so common that I think this makes a heck of a lot of sense as a warning. If my head of steam lasts long enough I may work up a patch.

And may I also say, AAAAAAAAAAAAAAAAARRRGGGRHHH.

Thank you.

-sam


In reply to The trap of reference numification by samtregar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.