Skip Menu |

This queue is for tickets about the UNIVERSAL-isa CPAN distribution.

Report information
The Basics
Id: 15578
Status: resolved
Priority: 0/
Queue: UNIVERSAL-isa

People
Owner: Nobody in particular
Requestors: SAMV [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: isa does not deal with overloaded objects
always remember overload and tie ... bits that will bite you in the ass :)
diff -ur UNIVERSAL-isa-0.04.orig/lib/UNIVERSAL/isa.pm UNIVERSAL-isa-0.04/lib/UNIVERSAL/isa.pm --- UNIVERSAL-isa-0.04.orig/lib/UNIVERSAL/isa.pm 2005-09-12 13:47:16.000000000 +1200 +++ UNIVERSAL-isa-0.04/lib/UNIVERSAL/isa.pm 2005-11-07 14:25:43.000000000 +1300 @@ -23,11 +23,11 @@ } sub UNIVERSAL::isa { - goto &$orig if not defined $_[0] or length $_[0] == 0; - # not an object or a class name, we can skip unless ( blessed($_[0]) ) { + goto &$orig if not defined $_[0] or length $_[0] == 0; + my $symtable = \%::; my $found = 1; diff -ur UNIVERSAL-isa-0.04.orig/t/bugs.t UNIVERSAL-isa-0.04/t/bugs.t --- UNIVERSAL-isa-0.04.orig/t/bugs.t 2005-09-12 13:47:17.000000000 +1200 +++ UNIVERSAL-isa-0.04/t/bugs.t 2005-11-07 14:25:03.000000000 +1300 @@ -2,7 +2,7 @@ use strict; -use Test::More tests => 6; +use Test::More tests => 7; BEGIN { use_ok('UNIVERSAL::isa', 'isa') }; @@ -76,3 +76,15 @@ unless ($@) { isa_ok(CGI->new(''), "CGI"); } + +# overloaded objects +{ + package Qibble; + use overload '""' => sub { die }; + *new = \&Foo::new; +} + +my $qibble = Qibble->new(); + +ok( isa( $qibble, 'Qibble' ), '... can test ISA on landmines'); +