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

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.
  • Heh (Score:2, Funny)

    by chromatic (983) on 2002.05.15 0:11 (#8429) Homepage Journal
    I've been there. Hold on, brother.

    My latest bugaboo was a relatively insane bit of embedded SQL. It was intended to update a product's property. (I still don't know what that means or entails.) It checked to see if it was actually deleting the property, so it could insert NULL. It checked to see if it had to update a key, where it did something else special. It eventually updated either a long or a short character column.

    The tricky part is, it interpolated the property name and the new property value into SQL embedded in a heredoc, built up over several statements through a couple of if/else couplets. When I noticed it was declaring a temporary stored procedure (yes, local to the SQL statement) just to check the keyness of the property, I was disturbed.

    Then I hit a row of doubled-up single ticks, a home-rolled quoting menace that hid the true horror: to save from having to check to see, on the Perl side, if the column held a short or a long string -- something already known by the time this was called -- he passed the column type to the SQL, did some text manipulation in SQL, and returned SQL from the first SQL call so Perl could send the generated statement back to the database.

    Only one of the four or five possible outcomes resulted in SQL coming back.

    This was the same guy who wrote an 1100 line stored procedure with the time-honored procedure of cut and paste and still managed to misspell a hardcoded category name several different ways... and people are surprised when the data's inconsistent.