8 unshift @INC, '../lib' if -d '../lib';
15 print "not " unless $a->isa("Bob");
29 $Alice::VERSION = 2.718;
34 sub test { print "not " unless shift; print "ok $i\n"; $i++; }
38 test $a->isa("Alice");
42 test $a->isa("Female");
44 test $a->isa("Human");
46 test ! $a->isa("Male");
48 test $a->can("drink");
52 test ! $a->can("sleep");
55 my @refs = qw(SCALAR SCALAR LVALUE GLOB ARRAY HASH CODE);
56 my @vals = ( \$b, \3.14, \substr($b,1,1), \*b, [], {}, sub {} );
57 for ($p=0; $p < @refs; $p++) {
58 for ($q=0; $q < @vals; $q++) {
59 test UNIVERSAL::isa($vals[$p], $refs[$q]) eq ($p==$q or $p+$q==1);
63 test ! UNIVERSAL::can(23, "can");
65 test $a->can("VERSION");
68 test ! $a->can("export_tags"); # a method in Exporter
70 test (eval { $a->VERSION }) == 2.718;
72 test ! (eval { $a->VERSION(2.719) }) &&
73 $@ =~ /^Alice version 2.71(?:9|8999\d+) required--this is only version 2.718 at /;
75 test (eval { $a->VERSION(2.718) }) && ! $@;
77 my $subs = join ' ', sort grep { defined &{"UNIVERSAL::$_"} } keys %UNIVERSAL::;
79 test $subs eq "can isa VERSION";
81 test $subs eq "VERSION can isa";
84 test $a->isa("UNIVERSAL");
86 # now use UNIVERSAL.pm and see what changes
89 test $a->isa("UNIVERSAL");
91 my $sub2 = join ' ', sort grep { defined &{"UNIVERSAL::$_"} } keys %UNIVERSAL::;
92 # XXX import being here is really a bug
94 test $sub2 eq "can import isa VERSION";
96 test $sub2 eq "VERSION can import isa";
99 eval 'sub UNIVERSAL::sleep {}';
100 test $a->can("sleep");
102 test ! UNIVERSAL::can($b, "can");
104 test ! $a->can("export_tags"); # a method in Exporter