Dear monks

I'm writing a little Internet application that uses Class::DBI as principle method to access the MySQL database. For this application i use universal unique identifiers, commonly known as guid or uuid's

During testing phase, one of the more elaborate test scripts sometimes generated errors. During investigation it came to me that, when a generated uuid has by coincidence a trailing space as bit presentation, the database would chop it off.

After correcting the database type to a TINYBLOB, the database left the trailing space an kept the guids correctly, but in my perl code the trailing space was still missing.

Reading through the cpan docs of class:dbi i noticed that they set the option 'ChopBlanks' by default on. Further according the doc of DBI, this option should only affect char attributes in the database. My type of attribute is TINYBLOB

_However_, overwriting the option 'ChopBlanks' back to zero solved my problem.

Googling about the option got me only a remark that 'ChopBlanks => 1' set by Class::DBI was maybe a legacy setting and could be ignored. But an annotation in the POD documentation says that what i'm doing is earning a ticket to hell.

So my dear monks, my question to you is:

  • Is setting ChopBlanks => 0 while using Class::DBI really dangerous, and why?
  • Is there another way to guarantee that i have my trailing space in the guid in and out of the DB using Class::DBI?

    Thanks in advance


    In reply to Class::DBI and the ChopBlanks option by martell

    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.