On 27/02/07, chromatic <[EMAIL PROTECTED]> wrote:
On Tuesday 27 February 2007 13:58, Michael G Schwern wrote:
> What is wrong with the proof-of-concept I proposed?
The lines:
my $real_isa = \&UNIVERSAL::isa;
...
if( ref $obj and eval { $obj->$real_isa("Test::MockObject") } ) {
Why not have something like
---
package UNIVERSAL::isa;
our %care_about;
sub import {
my $self = shift;
@[EMAIL PROTECTED] = ();
}
sub isa {
my ($obj, $class) = @_;
# do correct isa stuff
warn "my warning" if (exists $care_about{$class}) or (exists
$care_about{ref $obj});
}
*UNIVERSAL::isa = sub \&isa;
---
then in Test::MockObject;
use UNIVERSAL::isa __PACKAGE__;
you could even add caller() by default making no different at all.
Then you only give a warning when people call UNIVERSAL::isa on your
objects,
F