#!/usr/bin/perl -w
use strict;
use Test::More tests => 5;
package Foo;
sub new
{
my $class = shift;
return unless eval { $class->isa( __PACKAGE__ ) };
bless {}, $class;
}
sub is_object { 1 };
package Bar;
@Bar::ISA = 'Foo';
package main;
sub is_object { 0 };
my $foo = Foo->new();
isa_ok( $foo, 'Foo' );
my $bar = Bar->new();
isa_ok( $bar, 'Bar' );
ok( $foo->is_object(), '$foo is an object' );
ok( $bar->is_object(), '$bar is an object' );
my $hash = Foo::new( {} );
is( $hash, undef, 'Foo::new() should not bless a reference passed in'
+);