If things are as you say they are, I would consider that a bug with
DBI. A method should never, upon failure, simply return the error message in a string. That makes true/false type tests impossible. If I am writing a method that fails, I might print out a warning via
warn, sure, but I would ALWAYS return a false value from that method so that people using my code can test for success/failure based upon that. That is very brain-dead if (as you seem to indicate), DBI is returning a string where ordinarily we would see an array reference or a boolean true/false indication.
If the method under normal circumstances is returning a false value, and correctly printing its warnings via warn, this is not touched by eval:
$a = eval { warn "some warning\n"; }; # "some warning" to STDERR
print "a=$a\n"; # 1 ('warn' succeeds)
print "@=$@\n"; # <undefined>
We have to trap
$SIG{__WARN__} if we want to capture the "some warning" text. Otherwise it's printed straight to STDERR, even if we're in an eval block. Eval doesn't "return" the warning, it returns whatever its code returns (in this case, whatever
selectcol_arrayref returns). I think you're mistaken.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.