Perhaps I'm missing something, but shouldn't the returned value here be undefined? He's testing $ret. If the eval failed (died, whatever), $ret should be undefined. His test should work.
I think the problem though is that the eval isn't dying. It's just warning. $ret thus is set to the return of whatever the fetch method he used. If his eval died, we shouldn't see an error message at all, it should go into $@.
Sorry if I'm missing something or if we're talking about two slightly different things. | [reply] [d/l] [select] |
No,
cause the result of the query is the warning, which is a string, so the eval gives back a string and does not die, cause it has not interpreted the query but the query result.
Have a nice day
All decision is left to your taste
| [reply] |
$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. | [reply] [d/l] [select] |