package Void; sub void_sub { 'void sub' } package Empty; sub empty_sub { 'empty sub' } package Nothing; @Nothing::ISA = qw( Void Empty ); sub isa { 0 } my $uni_isa; BEGIN { $uni_isa = \&UNIVERSAL::isa; } { no warnings 'redefine'; # Subroutine UNIVERSAL::isa redefined sub UNIVERSAL::isa { ref $_[0] eq __PACKAGE__ ? 0 : goto &$uni_isa; } } package main; my @refs = ( ref {}, ref [], ref \do{my $x}, ref sub {}, ref qr// ); my $nothing = bless {}, 'Nothing'; foreach my $reftype ( @refs ) { ok( ! UNIVERSAL::isa( $nothing, $reftype ), "\$nothing is not $reftype" ); ok( ! $nothing->isa( $reftype ), "! \$nothing->isa( $reftype )" ); } ok( UNIVERSAL::isa( [], 'ARRAY' ), 'isa still works' ); ok( ! UNIVERSAL::isa( {}, 'ARRAY' ), 'isa still works (negation)' ); is( $nothing->void_sub(), 'void sub', 'method dispatch still works' );