[Mpls-pm] Code I whiteboarded tonight

Joshua ben Jore twists at gmail.com
Wed Sep 14 21:17:25 PDT 2005


On 9/14/05, Dave Rolsky <autarch at urth.org> wrote:
> So I said I'd send this out.
> 
> The discussion was related to overriding $SIG{__DIE__} and how you can do
> that more or less safely.
> 
> So here's the $SIG{__DIE__} handler used by Mason:
> 
>    sub rethrow_exception {
>        my ($err) = @_;
>        return unless $err;
> 
>        if ( UNIVERSAL::can($err, 'rethrow') ) {
>            $err->rethrow;
>        }
>        elsif ( ref $err ) {
>            die $err;
>        }

If you're going to use isa()/can() and you think your code might be
used by someone who writes tests, you should be using them as methods
anytime you have an object. People using Test::MockObject rely on the
method form of isa() being overrideable.

I haven't used T::MO myself but I think I'm accurately relaying what
the Test::MockObject users are typically complaining about.

Josh


More information about the Mpls-pm mailing list