in reply to Re: Strange bug involving mysql, auto_increment, Class::DBI and Test::MockObject
in thread Strange bug involving mysql, auto_increment, Class::DBI and Test::MockObject

Any code that uses UNIVERSAL::can() or UNIVERSAL::isa() as functions breaks Test::MockObject and Class::Roles. I can't fix that.

I can use UNIVERSAL::isa and UNIVERSAL::can in my code to warn people that things will break if they use them incorrectly and to try to route around the damage as much as possible.

Still, I don't have any sympathy for people who write broken code and expect it to work. If you break my code, you get to keep both pieces. Don't save your receipt.

Oh, and the Class::DBI code should likely be instead:

eval { $_->can( 'id' ) } and $_ = $_->id for grep { defined $_ } @pk_values;

Replies are listed 'Best First'.
Re^3: Strange bug involving mysql, auto_increment, Class::DBI and Test::MockObject
by stvn (Monsignor) on Dec 13, 2005 at 22:45 UTC
    I can use UNIVERSAL::isa and UNIVERSAL::can in my code to warn people that things will break if they use them incorrectly and to try to route around the damage as much as possible.

    I agree with you 100%, however, the problem is that UNIVERSAL::can actually dies, and not just warns in this particular case. The last error in the OPs post ...

    Can't call method "can" on an undefined value at /usr/local/share/perl/5.8.4/UNIVERSAL/can.pm line 40.
    is actually UNIVERSAL::can die-ing. This is is something too that (IMO) can be routed around fairly easily so I sent you a patch and test for this.

    -stvn