12 sub new { bless {}, shift }
18 sub new { bless {}, shift }
23 use Class::Struct 'struct'; # test out both forms
25 use Class::Struct SomeClass => { SomeElem => '$' };
27 struct( s => '$', a => '@', h => '%', c => 'aClass' );
33 print "not " unless $obj->s() eq 'foo';
38 print "not " unless ref $arf eq 'ARRAY';
41 $obj->a(2, 'secundus');
43 print "not " unless $obj->a(2) eq 'secundus';
48 print "not " unless ref $hrf eq 'HASH';
53 print "not " unless $obj->h('x') == 10;
58 print "not " if defined($orf);
61 $obj = MyObj->new( c => aClass->new );
64 print "not " if ref $orf ne 'aClass';
67 print "not " unless $obj->c->meth() == 42;
70 my $obk = SomeClass->new();
74 print "not " unless $obk->SomeElem() == 123;
79 print "not " unless $obj->a(1) == 5;
82 $obj->h({h=>7,r=>8,f=>9});
84 print "not " unless $obj->h('r') == 8;
87 my $recobj = RecClass->new() or print "not ";