in reply to Embedded Class::Struct Misbehaviour

shouldn't ref($dad) say "Person" ?
Not automatically. As the example in the Class::Struct doc shows, you need to initialize the field. Class::Struct enforces that it's the right type, but doesn't create the variable for you. You can do this:
$folks->head( new Person .... );
to initialize the field.

Replies are listed 'Best First'.
Re: Re: Embedded Class::Struct Misbehaviour
by shemp (Deacon) on Nov 06, 2002 at 20:23 UTC
    Actually, with the code from the original post, with Class::Struct 0.59, the print statement does report that $dad is a 'Person'.

    I'm new to Class::Struct, (should've started using it years ago), and don't exactly know what the proper behaviour is supposed to be, just writing little test progs to figure it out. I love it though.

    thanks