[Dbix-class] exception_action fail after DBIC upgrade

Konstantin A. Pustovalov lamoz at adriver.ru
Tue Jan 22 08:13:01 GMT 2013


>> Object which stringifies to empty string
>> is definitely not the same as empty string (the former is true value
>> while latter is not).
> Yes, except that it is a flawed assumption that folks check for
> "truthiness" of $@. In fact any code that does this (if ($@) { ... }) is
> arguably wrong. The only correct way to check for an exception is (if
> ($@ eq '') { ... } ) after an eval just took place. At which point you
> are landing straight into the trap that your exception objects are. Here
> is a little nonexhaustive search to convince you that the problem is not
> just academical [1]
Oh I see. Checking $@ reftype/magic etc is error-prone to use it here 
and there. It should be $@ eq ''.

> Which brings me to your pull request - it can't be accepted as-is. The
> case of a ''-stringifying object is not business as usual. Hence the
> test you added needs to be tweaked to expect a *dfferent* exception,
> saying something like "Your exception thrown blah blah stringifies to
> the empty string - this is not ok, fix your exception library. Original
> exception was Foo::Bar=HASH(0x9bb77d0)." Or something like that.
I'll eventually fix test and file a bug for Exception::Class




More information about the DBIx-Class mailing list